【发布时间】:2012-03-06 19:08:26
【问题描述】:
我在 MS Web Developer 2010 Express 中创建了 WCF 服务库,其中 ITestSerivce 作为服务合同并提供了以下 Web.config 配置。但我收到这个错误 : 错误:无法从http://localhost:56016/TestService.svc 获取元数据 : 我不明白为什么网址是http://localhost:56016,而基地址是http://localhost:8001
谁能帮我解决这个问题。
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="TestService">
<host>
<baseAddresses>
<add baseAddress ="http://localhost:8001/" />
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="ITestService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<!--Setting httpGetEnabled you can publish the metadata -->
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="SampleServiceBinding">
<security/>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
【问题讨论】:
标签: wcf