【发布时间】:2011-12-29 16:43:54
【问题描述】:
我正在尝试学习 WCF,并在 VS2010 中创建了一个新的 WCF 服务库项目。我没有对默认项目进行任何更改,但是当我运行它时,WCF 测试客户端显示错误。当我在浏览器中导航到元数据端点时,结果是一个空白页面。
我错过了什么?我本来希望一个全新的、未受影响的项目能够正常工作。
这是完整的错误:
错误:工具发生错误。错误:找不到配置绑定扩展“system.serviceModel/bindings/netTcpRelayBinding”。验证此绑定扩展已在 system.serviceModel/extensions/bindingExtensions 中正确注册,并且拼写正确。
服务主机似乎工作正常。
这是配置文件。就像“开箱即用”一样
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="SrvLib.Service1">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8732/Design_Time_Addresses/SrvLib/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<!-- Unless fully qualified, address is relative to base address supplied above -->
<endpoint address ="" binding="wsHttpBinding" contract="SrvLib.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. -->
<!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="True"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
【问题讨论】:
-
你能发布配置文件,包括行为、端点等吗?