简体   繁体   English

IIS错误在共享Web主机上托管WCF数据服务

[英]IIS error hosting WCF Data Service on shared web host

My client has a website hosted on a shared web server. 我的客户有一个托管在共享Web服务器上的网站。 I don't have access to IIS. 我无权访问IIS。 I am trying to deploy a WCF Data Service onto his site. 我正在尝试将WCF数据服务部署到他的站点上。 I am getting this error: 我收到此错误:

IIS specified authentication schemes 'IntegratedWindowsAuthentication, Anonymous', but the binding only supports specification of exactly one authentication scheme. IIS指定了身份验证方案“ IntegratedWindowsAuthentication,Anonymous”,但是绑定仅支持仅指定一种身份验证方案。 Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. 有效的身份验证方案为摘要,协商,NTLM,基本或匿名。 Change the IIS settings so that only a single authentication scheme is used. 更改IIS设置,以便仅使用单个身份验证方案。

I have searched SO and other sites quite a bit but can't seem to find someone with my exact situation. 我已经搜索了很多SO和其他站点,但似乎找不到符合我确切情况的人。 I cannot change the IIS settings because this is a third party's server and it is a shared web server. 我不能更改IIS设置,因为这是第三方服务器,并且是共享的Web服务器。 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. Windows身份验证设置是通过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 =) 希望有帮助=)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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