我创建了一个 RESTful WCF 服务(感谢 StackOverflow)。我创建了一个测试客户端,它是一个简单的 .aspx 页面,带有 5 个文本框和一个提交按钮。当我在文本框中输入数据并单击提交按钮时,它会将数据提交到 WCF 服务。
我的 WCF 服务在 Visual Studio 开发服务器下运行并且运行良好,我能够成功地将数据发送到 WCF 服务。今天我在本地 IIS 上部署了这个 WCF 服务。当我尝试在客户端应用程序(.aspx 页面)中引用服务 URL 时,我收到此错误。
“元数据包含无法解析的引用。客户端和服务绑定可能不匹配。无法处理消息,因为内容类型 'application/soap+xml; charset=utf-8' 不是预期的类型 'text/xml; "
知道问题可能是什么吗?这是我的 web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="RESTService1">
<endpoint address="http://localhost:420/WCFRESTService100/RESTService1.svc" binding="webHttpBinding" name="MainHttpPoint" contract="RESTService1" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:420/WCFRESTService100/RESTService1.svc" />
</baseAddresses>
</host>
</service>
</services>
<!--<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>-->
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>