title: WCF Service Impersonation
body: <p>Good Day Everyone...</p>
  
  <p>Apparently, I'm not setting-up impersonation correctly for my WCF service.  I do NOT want to set security on a method-by-method basis (in the actual code-behind).  The service (at the moment) is open to be called by everyone on the intranet.</p>
  
  <p>So my questions are…</p>
  
  <p>Q: What web-config tags am I missing?</p>
  
  <p>Q: What do I need to change in the web-config to make impersonation work?</p>
  
  <p><strong>The Service Web.config Looks Like...</strong></p>
  
  <pre><code>&lt;configuration&gt;
      &lt;system.web&gt;
          &lt;authorization&gt;
              &lt;allow users="?"/&gt;
          &lt;/authorization&gt;
          &lt;authentication mode="Windows"/&gt;
          &lt;identity impersonate="true" userName="MyDomain\MyUser" password="MyPassword"/&gt;
      &lt;/system.web&gt;
      &lt;system.serviceModel&gt;
          &lt;services&gt;
              &lt;service behaviorConfiguration="wcfFISH.DataServiceBehavior" name="wcfFISH.DataService"&gt;
                      &lt;endpoint address="" binding="wsHttpBinding" contract="wcfFISH.IFishData"&gt;
                      &lt;identity&gt;
                          &lt;dns value="localhost"/&gt;
                      &lt;/identity&gt;
                  &lt;/endpoint&gt;
                      &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
                  &lt;/service&gt;
              &lt;/services&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior name="wcfFISH.DataServiceBehavior"&gt;
                      &lt;serviceMetadata httpGetEnabled="false"/&gt;
                      &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
          &lt;/behaviors&gt;
      &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>