【发布时间】:2010-12-20 01:41:55
【问题描述】:
我已将文件传输服务从 basicHttpBinding 移至 netTcpBinding 因为我正在尝试设置双工模式通道。我也开始了我的 net.tcp 端口共享服务。
我目前处于开发阶段,并且在我们移动之前在 xp 盒子上进行自我托管 应用到开发服务器。所以,目前,我无法访问 IIS。
这样配置我的服务后:
<service behaviorConfiguration="transferServiceBehavior" name="API.FileTransfer.FileTransferService">
<endpoint name="MyFileTransferEP"
address = ""
binding = "netTcpBinding"
bindingConfiguration="MyFileTransferNetTcpEP"
behaviorConfiguration="NetTcpEPBehavior"
contract="API.FileTransfer.IFileTransferService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8001/project/filetransfer.svc" />
</baseAddresses>
</host>
</service>
而且,我的绑定是这样的:
<netTcpBinding>
<binding name="MyFileTransferNetTcpEP"
hostNameComparisonMode="StrongWildcard"
closeTimeout="00:01:00"
openTimeout="00:01:00"
receiveTimeout="00:10:00"
sendTimeout="00:01:00"
maxReceivedMessageSize="2147483647"
transferMode="Streamed"
portSharingEnabled="true">
<security mode="None">
<transport clientCredentialType="None" />
<message clientCredentialType="None" />
</security>
</binding>
</netTcpBinding>
当我正确浏览 SVC 文件时出现以下错误:
找不到一个基地址 匹配方案 net.tcp 的 具有绑定 NetTcpBinding 的端点。 注册的基地址方案是 [http]。
网上的阅读建议,为了解决这个问题,我 需要将 net.tcp 绑定添加到应用程序的绑定中 在 IIS 中。但是,如果我是自托管并且无权访问,我该怎么办? 信息系统??顺便说一句,如果您正在阅读本文并且“确实”拥有 IIS,请执行以下操作: 右键单击 IIS 中的虚拟目录/应用程序 -> 管理应用程序 -> 高级设置。并且,在 Enabled Protocols 部分,添加 net.tcp。
有什么想法吗?
更新:我以为我可以正常工作,但仍然无法正常工作。这是我现在拥有的: 我仍然收到“找不到与方案 net.tcp 匹配的基地址”错误。 我已更改所有基址以反映您的建议。这是我现在拥有的:
<service behaviorConfiguration="transferServiceBehavior" name="API.FileTransfer.FileTransferService">
<endpoint name="MyJSONFileTransferEP"
address="json"
binding="webHttpBinding"
bindingConfiguration="jsonWeb"
behaviorConfiguration="WebHttpEPBehavior"
contract="API.FileTransfer.IJSONFileTransferService" />
<endpoint name="MyPOXFileTransferEP"
address="pox"
behaviorConfiguration="WebHttpEPBehavior"
binding="webHttpBinding"
bindingConfiguration="poxWeb"
contract="API.FileTransfer.IPOXFileTransferService" />
<endpoint name="MySOAPFileTransferEP"
address="filetransfer"
binding="netTcpBinding"
bindingConfiguration="netTcpWeb"
behaviorConfiguration="NetTcpEPBehavior"
contract="API.FileTransfer.ISOAPFileTransferService" />
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:2544/filetransfer/" />
</baseAddresses>
</host>
</service>
我已经对“net.tcp://localhost:2544”和“net.tcp://localhost:8001”进行了尝试。 我是否需要在我的防火墙设置中添加(允许)某些内容?还有其他建议吗?
这是我的 App.config 文件中的 filetransferservice 的 mexTcpBinding:
<endpoint address="net.tcp://localhost:2544/filetransfer/mex"
binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange"
name="filetransfermex">
<identity>
<certificateReference storeName="My" storeLocation="LocalMachine"
x509FindType="FindBySubjectDistinguishedName" />
</identity>
</endpoint>
我仍然无法在我的网络应用程序中引用我的 FileTransferServiceClient。
再次感谢。
【问题讨论】:
-
好吧,使用 baseAddress="net.tcp://localhost:2544/filetransfer/" 和 address="filetransfer" 在您的端点上,您的完整 URL 将是“net.tcp://localhost :2544/filetransfer/filetransfer" - 你尝试在那里连接吗??
-
谢谢 - 愚蠢的疏忽。我通常在那里有“肥皂”并将其改回来。在过去的一个小时里,我用细齿梳子检查了我的 App.config 和 Web.config 文件,终于让它编译了。当我“添加服务参考”时,我可以参考 ../trade/mex 和 .../auth/mex 但我的 net.tcp .../filetransfer/mex 永远不会显示为选项。所以,除了我无法从我的 Web 应用程序访问 FileTransferServiceClient 之外,一切都编译得很好。知道为什么 .../filetransfer/mex 没有出现吗?我正在使用 mexTcpBinding 并在我的问题中发布了它的样子。再次感谢。