【发布时间】:2011-04-16 20:48:30
【问题描述】:
我正在使用 VSTS 2010 + C# + .Net 4.0 + IIS 7.5 + Windows 7。我在此处遵循 MSDN 示例,没有任何修改,http://msdn.microsoft.com/en-us/library/ms733766.aspx
当我在 IIS 中打开 service.svc 文件(在 IIS 管理器中,右键单击 svc 文件并选择浏览)时,出现这样的错误,有什么问题吗?
在服务列表 CalculatorService 中找不到协议名称“IMetadataExchange”。将ServiceMetadataBehavior添加到配置文件或直接添加到ServiceHost
这是我正在使用的 web.config,
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<services>
<!-- This section is optional with the default configuration
model introduced in .NET Framework 4 -->
<service name="Microsoft.ServiceModel.Samples.CalculatorService">
<!-- This endpoint is exposed at the base address provided by host: http://localhost/servicemodelsamples/service.svc -->
<endpoint address=""
binding="wsHttpBinding"
contract="Microsoft.ServiceModel.Samples.ICalculator" />
<!-- The mex endpoint is exposed at http://localhost/servicemodelsamples/service.svc/mex -->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
</configuration>
【问题讨论】:
标签: c# .net wcf visual-studio-2010