我收到异常错误消息:
Content Type text/xml; charset=utf-8 was not supported by service
http://localhost:8000/GettingStarted/CalculatorService/.
The client and service bindings may be mismatched.
我的客户端应用程序 app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ICalculator" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8000/GettingStarted/CalculatorService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ICalculator"
contract="Calculatorservice.ICalculator" name="BasicHttpBinding_ICalculator" />
</client>
</system.serviceModel>
</configuration>
我的服务 app.config 是
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="GettingStartedLib.CalculatorService">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8000/GettingStarted/CalculatorService/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="GettingStartedLib.ICalculator">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我是 WCF 服务的新手。我完全糊涂了,无法弄清楚我哪里出错了。我还没有在我的 IIS 中托管 wcf 服务。一旦 wcf 主机应用程序运行,我就能够成功浏览(控制台应用程序运行服务)