2010-10-16 100 views
0

我的客户端有一个托管在共享Web服务器上的网站。我没有访问IIS的权限。我正在尝试在他的网站上部署一个WCF数据服务。我收到此错误:在共享Web主机上托管WCF数据服务的IIS错误

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.

我有搜索等网站颇有几分,但似乎无法找人与我的确切情况。我无法更改IIS设置,因为这是第三方的服务器,并且它是共享的Web服务器。所以我唯一的选择是在代码或服务配置中更改内容。我的服务配置如下所示:

<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> 

正如您所看到的,我试图将安全模式设置为“无”,但似乎没有帮助。我应该改变什么来解决这个错误?

回答

0

我不太了解这个,但从阅读this文章我认为你不能直接从配置设置身份验证无。

Windows验证设置通过IIS进行。

您是否尝试过在你的代码这样做,可以调用任何数据之前:

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

当然你要有用户名,密码和域名。

希望帮助=)