C# WCF中的IMetadatae交换问题
我使用的是VSTS 2010+C+.NET4.0+IIS7.5+Windows7。我在这里遵循MSDN样本,没有任何修改 当我在IIS管理器中打开service.svc文件时,右键单击该svc文件并选择“在IIS中浏览”,会出现类似这样的错误,您知道怎么回事吗 在服务列表CalculatorService中找不到协议名IMAdataExchange。将ServiceMetadataBehavior添加到配置文件或直接添加到ServiceHost 这是我正在使用的web.configC# WCF中的IMetadatae交换问题,c#,.net,wcf,visual-studio-2010,C#,.net,Wcf,Visual Studio 2010,我使用的是VSTS 2010+C+.NET4.0+IIS7.5+Windows7。我在这里遵循MSDN样本,没有任何修改 当我在IIS管理器中打开service.svc文件时,右键单击该svc文件并选择“在IIS中浏览”,会出现类似这样的错误,您知道怎么回事吗 在服务列表CalculatorService中找不到协议名IMAdataExchange。将ServiceMetadataBehavior添加到配置文件或直接添加到ServiceHost 这是我正在使用的web.config <?x
<?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>
请您提供一些关于您配置您的服务的方式的详细信息 此链接包含以下步骤。第5点和第6点应该是你感兴趣的 帕万 尝试将此行为添加到配置文件:
<behaviors>
<serviceBehaviors>
<behavior name="CalculatorServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
并更改服务元素以添加此行为:
<service
name="Microsoft.ServiceModel.Samples.CalculatorService"
behaviorConfiguration="CalculatorServiceBehavior">
问候,
帕万谢谢劳茨!你给出的链接是关于如何进行自我托管的。我正在做IIS托管。我已经在我的原始帖子中发布了我的web.config,有什么想法吗?如果您需要任何进一步的信息做分析,请让我知道。提前谢谢!谢谢劳茨!格式看起来不太好。如果您可以在回复中发布您建议的web.config,并编辑您的帖子以进行更新,则不胜感激。如果您阅读了同一MSDN文章的第3条评论,您将找到解决方案:@rauts,我查看了第3条评论,但无法理解。您能解释一下为什么它在与msdn相同的情况下不起作用吗?