我正在尝试使用匿名身份验证创建 WCF 服务。当我将服务部署到不在我当前域上的目标服务器时,我在尝试调用它时收到以下错误:
内容类型应用程序/soap+xml;服务http://myserver.com/page.svc不支持 charset=utf-8 。客户端和服务绑定可能不匹配。
就目前而言,我的 web.config 文件中有以下部分用于服务:
<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)。这是我在使用 wsHttpBinding 时尝试使用的 web.config 部分
<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>
该服务是使用 .NET 4.0 框架创建的。我需要它是匿名的,但我不确定我错过了什么。我是 WCF 的新手,所以我还没有把所有的鸭子排成一排。
谢谢,