WCF 无法找到 netTcpBinding
我正在尝试创建一个可通过 webHttpBinding 和 netTcpBinding 访问的 WCF 服务。我已经成功地通过 Java 客户端访问 webHttpBinding,现在我正在尝试让 netTcpBinding 工作。
我已经设置了这样的配置;
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="httpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="MR_Jukebox_Service.JukeboxService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service/"/>
<add baseAddress="net.tcp://localhost:8523/Design_Time_Addresses/MR_Jukebox_Service/net/"/>
</baseAddresses>
</host>
<endpoint address=""
behaviorConfiguration="httpBehavior"
binding="webHttpBinding"
contract="MR_Jukebox_Service.IJukeboxService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="MR_Jukebox_Service.IJukeboxService" />
<endpoint address="net.tcp://localhost:8523/Design_Time_Addresses/MR_Jukebox_Service/net"
binding="netTcpBinding"
bindingConfiguration=""
contract="MR_Jukebox_Service.IJukeboxService" />
</service>
</services>
</system.serviceModel>
在同一解决方案中,我有一个测试应用程序,我希望连接到 netTcpBinding,我右键单击“服务引用”并选择“添加服务引用...”。 当我点击“发现”时,它找到了该服务,尽管说:
下载“http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service”时出错。 请求失败,HTTP 状态为 404:未找到。 元数据包含无法解析的引用:“http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service”。 http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service 上没有侦听可以接受消息的端点。这通常是由不正确的地址或 SOAP 操作引起的。有关更多详细信息,请参阅 InnerException(如果存在)。 远程服务器返回错误:(404) 未找到。 如果当前解决方案中定义了该服务,请尝试构建该解决方案并再次添加服务引用。
但我也无法看到 netTcpBinding 以便我创建对其的服务引用。
我想知道是否有人能看到我做错了什么,因为它可能相当简单,但由于我缺乏 WCF 经验,所以没有注意到。
感谢您提前提供的任何帮助。
I am trying to create a WCF service that is accessible through both webHttpBinding and netTcpBinding. I have been successful in getting the webHttpBinding to be accessible through a Java client and now I'm working on trying to get the netTcpBinding working.
I have set up the configuration like this;
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="httpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="MR_Jukebox_Service.JukeboxService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service/"/>
<add baseAddress="net.tcp://localhost:8523/Design_Time_Addresses/MR_Jukebox_Service/net/"/>
</baseAddresses>
</host>
<endpoint address=""
behaviorConfiguration="httpBehavior"
binding="webHttpBinding"
contract="MR_Jukebox_Service.IJukeboxService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="MR_Jukebox_Service.IJukeboxService" />
<endpoint address="net.tcp://localhost:8523/Design_Time_Addresses/MR_Jukebox_Service/net"
binding="netTcpBinding"
bindingConfiguration=""
contract="MR_Jukebox_Service.IJukeboxService" />
</service>
</services>
</system.serviceModel>
In the same solution, I have a test application that I wish to connect to the netTcpBinding, I've right clicked on "Service References" and chosen "Add Service Reference...".
When I click on "Discover" it finds the service although says;
There was an error downloading 'http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service'.
There was no endpoint listening at http://localhost:8732/Design_Time_Addresses/MR_Jukebox_Service that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found.
If the service is defined in the current solution, try building the solution and adding the service reference again.
But I am also unable to see the netTcpBinding in order for me to create a service reference to it.
I was wondering whether anyone can see what I am doing wrong as its probably something rather simple, but due to my lack of experience with WCF haven't noticed.
Thanks for any help in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试将您的 mex 端点更改为:
您正在使用 mex 端点的服务合同,我认为这不起作用。
您可以为 NetTcpBinding 设置类似的设置:
Try changing your mex endpoint to this:
You were using your service's contract for the mex endpoint, which I don't believe will work.
You can set up a similar one for the NetTcpBinding:
您是否正在尝试让 netTcpBinding 与 java 客户端一起使用?因为,netTcpBinding 仅适用于 .net 客户端。
NetTcpBinding 不是为互操作而设计的,它是为服务器和客户端都是 .net 时的性能而设计的
Are you trying to get the netTcpBinding to work with a java client ? Because, netTcpBinding only works with a .net client.
NetTcpBinding is not designed for interop, it's designed for performance when both the server and client are .net