none
WCF Service Deployment Question 2 - SecurityNegotiationException - The caller was not authenticated by the service. RRS feed

  • Question

  • This may be an old problem for some as I searched and looked at quite a few Internet discussions on this topic. The solutions they provided, however, did not solve my problem.

    As this happened on many cases, if my WCF service and client are on the same machine, no problem. When the WCF service is running from a remote server, this exception happens.

    I've followed a few suggestions and modified my web.config of the WCF service, but the error persisted. Here is my web.config file. Any help or hint is greatly appreciated.

    <?xml version="1.0"?>
    <configuration>
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
      </appSettings>
      <system.web>
      <identity impersonate="true" userName="mydomain\myusername" password="mypassword"/>
      <trust level="Full"></trust>
      <compilation debug="true" targetFramework="4.5.1">
          <assemblies>
            <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
          </assemblies>
        </compilation>
        <httpRuntime targetFramework="4.5.1"/>
      </system.web>
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding>
              <security mode="Message">
                <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
                <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" />
              </security>
            </binding>
          </wsHttpBinding>
       </bindings>
       <behaviors>
          <serviceBehaviors>
            <behavior>
              <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
              <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
            <behavior name="WcfServiceZamanService.Service1Behavior">
              <serviceMetadata httpGetEnabled="true"/>
              <serviceDebug includeExceptionDetailInFaults="false"/>
            </behavior>
          </serviceBehaviors>
          <endpointBehaviors>
            <behavior name="web">
              <webHttp/>
            </behavior>
          </endpointBehaviors>
        </behaviors>
        <protocolMapping>
          <!-- add binding="basicHttpsBinding" scheme="https"/>-->
          <add binding="wsHttpBinding" scheme="http"/>
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
        <services>
          <service name="WcfServiceZamanService.TrackingService" behaviorConfiguration="WcfServiceZamanService.Service1Behavior">
            <endpoint address="" binding="webHttpBinding" contract="WcfServiceZamanService.ITrackingService" behaviorConfiguration="web">
              <identity>
                <dns value="localhost"/>
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
          </service>
        </services>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="false"/>
        <!--
            To browse web app root directory during debugging, set the value below to true.
            Set to false before deployment to avoid disclosing web app folder information.
          -->
        <directoryBrowse enabled="true"/>
      </system.webServer>
    </configuration>

    Monday, August 10, 2015 11:46 PM

Answers

All replies