无法调度消息,因为终结点地址“net.tcp://pc2017*****/Service2.svc/mex”上的服务对该地址的协议不可用。

qq_36593316 2017-06-19 10:05:27
出现这种问题改怎么解决?
很多方法我都试了都没用.
...全文
1109 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_36593316 2017-06-19
  • 打赏
  • 举报
回复
在线等,急!!
qq_36593316 2017-06-19
  • 打赏
  • 举报
回复
svcutil.exe net.tcp://pc201702101257/Service2.svc/mex 这将生成一个配置文件和一个包含客户端类的代码文件。请将这两个文件添加到客户端应用程序,并使用生成的客户端类来调用服务 是不是我没有进行这个操作导致的啊?
qq_36593316 2017-06-19
  • 打赏
  • 举报
回复
引用 6 楼 xdashewan 的回复:
httpGetEnabled="True"用false你不发布WSDL
我改成false 发布到iis是可以看得到服务在运行的

Service2 服务

已创建服务。

若要测试此服务,需要创建一个客户端,并将其用于调用该服务。可以使用下列语法,从命令行中使用 svcutil.exe 工具来进行此操作:


svcutil.exe net.tcp://pc201702101257/Service2.svc/mex
这将生成一个配置文件和一个包含客户端类的代码文件。请将这两个文件添加到客户端应用程序,并使用生成的客户端类来调用服务。例如:

C#

class Test
{
    static void Main()
    {
        Service2Client client = new Service2Client();

        // 使用 "client" 变量在服务上调用操作。

        // 始终关闭客户端。
        client.Close();
    }
}

Visual Basic

Class Test
    Shared Sub Main()
        Dim client As Service2Client = New Service2Client()
        ' 使用 "client" 变量在服务上调用操作。

        ' 始终关闭客户端。
        client.Close()
    End Sub
End Class
然后我打开pc201702101257/Service2.svc/mex这个链接显示HTTP Error 404. The requested resource is not found.,我觉得是这个问题
xdashewan 2017-06-19
  • 打赏
  • 举报
回复
httpGetEnabled="True"用false你不发布WSDL
qq_36593316 2017-06-19
  • 打赏
  • 举报
回复
他直接在服务添加引用那里就报错了 无法识别该 URI 前缀。 元数据包含无法解析的引用:“net.tcp://pc201702101257/Service2.svc/mex”。 无法调度消息,因为终结点地址“net.tcp://pc201702101257/Service2.svc/mex”上的服务对该地址的协议不可用。 如果该服务已在当前解决方案中定义,请尝试生成该解决方案,然后再次添加服务引用。
qq_36593316 2017-06-19
  • 打赏
  • 举报
回复
引用 3 楼 xdashewan 的回复:
参考http://www.cnblogs.com/zxj159/p/3927556.html
就是 <serviceBehaviors> <behavior name="MyBehavior" > <serviceMetadata httpGetEnabled="True" httpsGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> 这一块,我目前的代码是这样的,生成的链接是http://192.168.1.**.*/Service2.svc?wsdl的,但是我需要的是 net.tcp://pc201702101257/Service2.svc/mex,然后就是上面的可以服务引用成功,下面的不行。
xdashewan 2017-06-19
  • 打赏
  • 举报
回复
参考http://www.cnblogs.com/zxj159/p/3927556.html
qq_36593316 2017-06-19
  • 打赏
  • 举报
回复
客户端配置

<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IService2">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://pc201702101257/Service2.svc" binding="netTcpBinding"
bindingConfiguration="NetTcpBinding_IService2" contract="ServiceReference1.IService2"
name="NetTcpBinding_IService2" />
</client>
</system.serviceModel>

服务器配置

<system.serviceModel>
<protocolMapping>
<add scheme="tcp" binding="netTcpBinding"/>
</protocolMapping>
<bindings>
<netTcpBinding>
<binding name="netTcpBindConfig" closeTimeout="00:30:00" portSharingEnabled="true"
openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10">
<readerQuotas maxDepth="2147483647"
maxStringContentLength="2147483647"
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:01:00" enabled="false" />
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
<services>
<service behaviorConfiguration="MyBehavior" name="Ais系统.Service.MyService">
<endpoint address="" binding="netTcpBinding" contract="AisContract.IMyService" bindingConfiguration="netTcpBindConfig"></endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" ></endpoint>
</service>

</services>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehavior" >
<serviceMetadata/>
<serviceDebug includeExceptionDetailInFaults="true" />
<dataContractSerializer maxItemsInObjectGraph="6553600"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>

@gac520
浪子-无悔 2017-06-19
  • 打赏
  • 举报
回复
WCF 的配置错误可能性比较大!
qq_36593316 2017-06-19
  • 打赏
  • 举报
回复
有点麻烦,我先搞一下吧

1,978

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 其他语言讨论
社区管理员
  • 其他语言社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧