我正在开发一个WCF应用程序,其绑定必须是“netTcpBinding”但是当我在Visual Studio 2013中运行时,我收到此错误“无法获取元数据http:// localhost:62081 / Queue.svc”。我一如既往地搜索,但没有找到工作的例子。我想了解这是如何工作的。谢谢!!!您将在下面找到我的网络配置:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="QueueBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="QueueBehavior" name="ComponenteCola.Queue">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
name="QueueNetTcpEndPoint" contract="ComponenteCola.IQueue" />
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
name="NetTcpMetadataPoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:57965/Queue" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
答案 0 :(得分:0)
希望仍有帮助
我认为它需要实际的元数据网址,请尝试像这样添加
<baseAddresses>
<add baseAddress="net.tcp://localhost:57965/Queue" />
<add baseAddress="http://localhost:62081/Queue/mex" />
</baseAddresses>
我正在使用.NET 4自行托管的WCF服务,但我认为不会有太多差异。
HTH