“/wcf”应用程序中的服务器错误。
没有与给定的地址“http://localhost:8001/WCFService.HelloService”匹配的协议绑定。协议绑定在 IIS 或 WAS 配置中的站点级别配置。
报这个错说明配置文件没有配置正确 。
错误:
<system.serviceModel>
<services>
<service behaviorConfiguration="WCFService.Service1Behavior"
name="WCFService.HelloService">
<!--<host>
<baseAddresses>
<add baseAddress="http://localhost:8001/"/>
</baseAddresses>
</host>-->
<endpoint address="http://localhost:8001/HelloService" binding="wsHttpBinding" contract="WCFService.IHelloService">
</endpoint>
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFService.Service1Behavior">
<!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点-->
<serviceMetadata httpGetEnabled="true"/>
<!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
正确:
<system.serviceModel>
<services>
<service behaviorConfiguration="WCFService.Service1Behavior"
name="WCFService.HelloService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8001/"/>
</baseAddresses>
</host>
<endpoint address="HelloService" binding="wsHttpBinding" contract="WCFService.IHelloService">
</endpoint>
<!--<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WCFService.Service1Behavior">
<!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点-->
<serviceMetadata httpGetEnabled="true"/>
<!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息-->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>