简体   繁体   中英

IIS error hosting WCF Data Service on shared web host

My client has a website hosted on a shared web server. I don't have access to IIS. I am trying to deploy a WCF Data Service onto his site. I am getting this error:

IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.

I have searched SO and other sites quite a bit but can't seem to find someone with my exact situation. I cannot change the IIS settings because this is a third party's server and it is a shared web server. So my only option is to change things in code or in the service config. My service config looks like this:

<system.serviceModel xdt:Transform="Insert">
  <serviceHostingEnvironment>
    <baseAddressPrefixFilters>
      <add prefix="http://www.somewebsite.com"/>
    </baseAddressPrefixFilters>
  </serviceHostingEnvironment>
  <bindings>
    <webHttpBinding>
      <binding name="{Binding Name}" >
        <security mode="None" />
      </binding>
    </webHttpBinding>
  </bindings>
  <services>
    <service name="{Namespace to Service}">
      <endpoint address="" binding="webHttpBinding" bindingConfiguration="{Binding Name}" contract="System.Data.Services.IRequestHandler">
      </endpoint>
    </service>
  </services>
</system.serviceModel>

As you can see I tried to set the security mode to "None" but that didn't seem to help. What should I change to resolve this error?

Im not too sure about this but from reading this article I think you cannot set the authentication to none straight from the config.

The windows auth settings are made via IIS.

Have you tried doing this in your code, before you call any data:

MyDataContext ctx = new MyDataContext(uri); 
ctx.Credentials = System.Net.CredentialCache.DefaultCredentials;  
ctx.Credentials = new NetworkCredential( 
    "username", 
    "password", 
    "domain");

Of course you have to have the username, password and domain.

Hope that helped =)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM