Pet*_*ter 30 c# wcf duplex net.tcp
当我尝试设置双工模式通道时,我已将文件传输服务从basicHttpBinding移动到netTcpBinding.我还启动了net.tcp端口共享服务.
我目前在dev并且在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>
Run Code Online (Sandbox Code Playgroud)
而且,我的约束如下:
<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>
Run Code Online (Sandbox Code Playgroud)
当我正确浏览到SVC文件时,我得到了以下错误:
无法找到与绑定NetTcpBinding的端点匹配scheme net.tcp的基址.注册的基地址方案是[http].
在线阅读表明,为了解决这个问题,我需要将net.tcp绑定添加到IIS中应用程序的绑定.但是,如果我是自托管并且无法访问IIS,我该怎么办?顺便说一句,如果您正在阅读此内容并"执行"拥有IIS,请执行以下操作:右键单击IIS中的虚拟目录/应用程序 - >管理应用程序 - >高级设置.并且,在Enabled Protocols部分中,添加net.tcp.
有任何想法吗?
更新:我以为我有它工作,但它仍然无法正常工作.这是我现在拥有的:我仍然得到"找不到匹配scheme 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>
Run Code Online (Sandbox Code Playgroud)
我用"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>
Run Code Online (Sandbox Code Playgroud)
我仍然无法在我的网络应用程序中引用我的FileTransferServiceClient.
再次感谢.
小智 39
错误(WCF): 无法找到与绑定NetTcpBinding的端点匹配scheme net.tcp的基址.注册的基地址方案是[http].
步骤1:注意WAS(Windows进程激活服务)或非http协议支持仅受以下平台支持:•Windows Vista•Windows 7•Windows Server 2008
步骤2:IIS> WCF主机网站>管理应用程序>高级设置>启用协议>将值设置为HTTP,NET.TCP
mar*_*c_s 24
您只需要为服务定义基地址(而不是整个地址),然后在服务端点中定义其余地址.你在filetransfer.svc文件末尾的地址不是有效的基地址(它确实是一个文件地址)
<service behaviorConfiguration="transferServiceBehavior"
name="API.FileTransfer.FileTransferService">
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8001/project/" />
</baseAddresses>
</host>
<endpoint name="MyFileTransferEP"
address = "filetransfer"
binding = "netTcpBinding"
bindingConfiguration="MyFileTransferNetTcpEP"
behaviorConfiguration="NetTcpEPBehavior"
contract="API.FileTransfer.IFileTransferService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
Run Code Online (Sandbox Code Playgroud)
有了这个,并使用自托管,您的服务将在完整的地址提供:
net.tcp://localhost:8001/project/filetransfer
Run Code Online (Sandbox Code Playgroud)
由于这是net.tcp并且您是自托管的,因此根本不需要svc文件.
更新:如果您希望能够获取net.TCP基地址的元数据,则需要在您的<service>部分中公开这样的net.Tcp MEX端点:
<endpoint name="NetTcpMEX"
address="netTcpMex"
binding="mexTcpBinding"
contract="IMetadataExchange" />
Run Code Online (Sandbox Code Playgroud)
小智 16
IIS中"启用协议"条目中的空格=>选择虚拟目录/应用程序=>高级设置=>启用协议.例如http,net.tcp.(协议文本之间的空格
这应该是http,net.tcp (即协议文本之间没有空格)
对于未来的读者.
确保您没有使用IIS-Express.
这是我的"陷阱".
参考:
http://www.iis.net/learn/extensions/introduction-to-iis-express/iis-express-faq
Q: Does IIS Express support non-HTTP protocols such as net.tcp or MSMQ?
A: No. IIS Express only supports HTTP and HTTPS as its protocol.
Run Code Online (Sandbox Code Playgroud)
这是Visual Studio和web.csproj(或类似)属性和"Web"左侧选项卡下的属性.有一个名为"使用IIS Express"的复选框.取消选中.
执行此操作后,您仍然必须转到IIS(7)和"http,net.tcp"以获取"启用的协议"(如此处其他答案中所述)
此外,如果您收到命名管道特定错误.
无法找到与绑定NetNamedPipeBinding的端点匹配scheme net.pipe的基址.
然后,您需要将"net.pipe"添加到列表中.
例:
HTTP,的net.tcp,net.pipe
另请参阅下面的命名管道特定错误.
另外:检查这些相应的Windows服务(命名管道或tcp或两者)
(命名管道窗口服务)
NetPipeActivator
Net.Pipe Listener Adapter
Receives activation requests over the net.pipe protocol and passes them to the Windows Process Activation Service.
Run Code Online (Sandbox Code Playgroud)
(tcp windows服务)
NetTcpActivator
Net.Tcp Listener Adapter
Receives activation requests over the net.tcp protocol and passes them to the Windows Process Activation Service.
Run Code Online (Sandbox Code Playgroud)
经过大量的解决方案..我在这个博客中找到了最终解决方案 ..但是我将在这里解释整个过程..你需要按照以下步骤..
步骤1 :( Windows进程激活服务)或非http协议支持仅受以下平台支持:•Windows Vista•Windows 7•Windows Server 2008
步骤2: IIS> WCF主机网站>管理应用程序>高级设置>启用协议>将值设置为http,net.tcp
在第2步完成后检查您的问题是否已解决..如果不是,请按照以下步骤操作
步骤3:
在a中administrator-level Command Prompt window,运行以下命令.
%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='8082:*']
Run Code Online (Sandbox Code Playgroud)
重启IIS一次,否则您Failed to map the path '/'现在可能会遇到异常
您的应用程序提前设置将如下所示
| 归档时间: |
|
| 查看次数: |
65603 次 |
| 最近记录: |