我正在尝试使用匿名身份验证创建WCF服务。当我将服务部署到不在当前域中的目标服务器时,我在尝试调用它时收到以下错误:
内容类型应用/soap+xml;
http://myserver.com/page.svc
.
客户端和服务绑定可能是
不匹配。
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
</modules>
</system.webServer>
我一直在尝试各种绑定(wsHttpBinding和basicHttpBinding),但我要么收到上面的错误(使用basicHttpBinding),要么收到“访问被拒绝”消息(使用wsHttpBinding)。这是你的名字web.config文件我在使用wsHttpBinding时尝试使用的部分
<system.serviceModel>
<services>
<service behaviorConfiguration="AMP.MainBehavior" name="AMP.Main">
<endpoint address="" binding="wsHttpBinding" contract="AMP.IMain">
<identity>
<dns value="myservice.com"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="AMP.MainBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
该服务是使用.NET4.0框架创建的。我需要匿名,但我不确定我遗漏了什么。我是WCF的新手,所以我还没有把所有的鸭子排成一排。
谢谢您,