WCF - Windows authentication - Security settings require Anonymous

后端 未结 8 2258
耶瑟儿~
耶瑟儿~ 2020-12-08 13:40

I am struggling hard with getting WCF service running on IIS on our server. After deployment I end up with an error message:

Security settings for this service r

相关标签:
8条回答
  • 2020-12-08 13:57

    So it seems like pretty common issue. The point is to remove mex from your bindings:

    <endpoint address="mex" binding="mexHttpBinding" name="mex" contract="IMetadataExchange"></endpoint>
    

    Alternativelly you enable Anonymous access in IIS and in your web.config you make sure anonymous access is denied.

    Hope this will help some other soul. (I was 100% sure I tried it with mex removed. :-O )

    0 讨论(0)
  • 2020-12-08 13:58

    You may check this one. I managed to make it work as expected.

    <configuration>
      ...
      <system.serviceModel>
        ...
        <bindings>
          <basicHttpBinding>
            <binding>
              <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        ...
      </system.serviceModel>
      ...
    </configuration>
    
    0 讨论(0)
  • 2020-12-08 13:59

    Yes, it looks like you need to remove the mex endpoint completely. Setting

    <serviceMetadata httpGetEnabled="false"/>
    

    alone did not work. Thanks!

    0 讨论(0)
  • 2020-12-08 14:00

    Anonymous authentication can, and in some cases must be enabled for the service but not for the site.

    So check that your site's "root" authentication has only Windows Authentication enabled. Then expand your site, select 'service' folder and make sure that your service has Windows and Anonymous Authentication enabled.

    I had identical environment where this worked, only difference in these environments was the service's authentication. Problem in my case was not caused be selected providers (Ntlm or Negotiate) but the authentication settings for site and service.

    At least I had identical error message with basic MSSQL Master Data Services web site & service and this was the solution. I did get the error when running just the service but the site worked almost ok, MDS Explorer did not work because service's authentication settings were wrong at first. Cause of this miss-configuration might be a bug in MDS Configuration Manager when creating new MDS site?

    So in my case the problem was not to be fixed by doing any special editing to the web.config nor the ApplicationHost.config files, I didn't do any editing the config files. Just selected the correct authentication settings for the web site and it's service in IIS manager. I am not sure that this is the case in here, but maybe worth to try?

    0 讨论(0)
  • 2020-12-08 14:18

    Additional solution:

    You just have to make sure that the Service name and contract are correct.

    Hope it helps in some way.

    0 讨论(0)
  • 2020-12-08 14:18

    It appears this MEX binding issue was fixed in .NET 4.0. Changing our server's App Pool .NET CLR version from 2.0 to 4.0 cleared up the issue.

    0 讨论(0)
提交回复
热议问题