找不到与scheme net.tcp匹配的基址

时间:2009-11-24 21:43:32

标签: c# wcf duplex net.tcp

我已将文件传输服务从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,请执行以下操作: 右键单击IIS中的虚拟目录/应用程序 - &gt;管理应用程序 - &gt; 高级设置。并且,在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>

我用“net.tcp:// localhost:2544”&amp; “的net.tcp://本地主机: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。

再次感谢。

10 个答案:

答案 0 :(得分:39)

错误(WCF): 无法找到与绑定NetTcpBinding的端点匹配scheme net.tcp的基址。注册的基地址方案是[http]。

第1步: 注意WAS(Windows进程激活服务)或非http协议支持仅受以下平台支持: •Windows Vista • Windows 7的 •Windows Server 2008

  1. 转到开启或关闭Windows功能
  2. 转到Microsoft .NET Framework 3.5
  3. 检查Windows Communication Foundation HTTP激活
  4. 检查Windows Communication Foundation非HTTP激活
  5. 第2步: IIS&gt; WCF主机网站&gt;管理应用程序&gt;高级设置&gt;启用的协议&gt;将值设置为HTTP,NET.TCP

答案 1 :(得分:23)

您只需为服务定义基地(不是整个地址),然后在服务端点中定义其余地址。最后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>

有了这个,并使用自托管,您的服务将在完整的地址提供:

net.tcp://localhost:8001/project/filetransfer

由于这是net.tcp并且您是自托管的,因此根本不需要svc文件。

更新:如果您希望能够获取net.TCP基地址的元数据,则需要在<service>内公开这样的net.Tcp MEX端点部分:

        <endpoint name="NetTcpMEX"
                  address="netTcpMex"
                  binding="mexTcpBinding"
                  contract="IMetadataExchange" />

答案 2 :(得分:16)

IIS中的“启用的协议”条目中的空格=&gt;选择虚拟目录/应用程序=&gt;高级设置=&gt;启用协议。例如 http,net.tcp 。 (协议文本之间的空格

这应该是 http,net.tcp (即协议文本之间没有空格)

答案 3 :(得分:8)

为未来的读者。

确保使用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.

这是Visual Studio和web.csproj(或类似)属性和“Web”左侧选项卡下的属性。有一个名为“使用IIS Express”的复选框。取消选中。

执行此操作后,您仍然需要转到IIS(7)和“http,net.tcp”以获取“启用协议”(如此处其他答案中所述)

此外,如果您收到命名管道特定错误。

无法找到与绑定 NetNamedPipeBinding 的端点匹配scheme net.pipe的基址。

然后你需要在列表中添加“net.pipe”。

示例:

  

HTTP,的net.tcp,net.pipe

另请参阅以下命名管道特定错误。

Configure WCF as Named Pipe hosted on IIS7

另外:检查这些相应的Windows服务(命名管道或tcp或两者)

(命名管道窗口服务)

NetPipeActivator

Net.Pipe Listener Adapter

Receives activation requests over the net.pipe protocol and passes them to the Windows Process Activation Service.

(tcp windows service)

NetTcpActivator

Net.Tcp Listener Adapter

Receives activation requests over the net.tcp protocol and passes them to the Windows Process Activation Service.

答案 4 :(得分:6)

经过大量的解决方案..我在blog找到了最终解决方案 ..但是我要在这里解释整个过程..你需要遵循以下步骤..

<强>步骤1: (Windows Process Activation Service)或非http协议支持仅受以下平台支持:•Windows Vista•Windows 7•Windows Server 2008

  • 转到开启或关闭Windows功能
  • 转到Microsoft .NET Framework 3.5
  • 检查Windows Communication Foundation HTTP激活
  • 检查Windows Communication Foundation非HTTP激活

第2步: IIS&gt; WCF主机网站&gt;管理应用程序&gt;高级设置&gt;启用的协议&gt;将值设置为 http,net.tcp

  

在第2步完成后检查您的问题是否已解决..如果不是,请按照以下步骤进行操作

第3步:administrator-level Command Prompt window中,运行以下命令。

%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='8082:*']

重启IIS 一次,否则您现在可以获得Failed to map the path '/'例外

您的应用程序提前设置将如下所示

enter image description here

答案 5 :(得分:4)

请从控制面板安装“非Http激活”窗口组件 - &gt;程序 - &gt;打开或关闭窗口 - &gt;特点 - &gt;添加功能 - &gt; .net framework * features - &gt; Wcf激活 - &gt;非Http激活。

答案 6 :(得分:3)

对于Windows 10
第1步:打开和关闭Windows功能&gt; .Net Framework 4.6高级服务&gt; WCF服务&gt; TCP激活

第2步:IIS&gt; WCF主机网站&gt;管理应用程序&gt;高级设置&gt;启用的协议&gt;将值设置为net.tcp,http

步骤3:打开具有管理权限的命令控制台&gt;输入iisreset

答案 7 :(得分:1)

我遇到了同样的问题(环境:Win7 / IIS7.5 .NET4),我通过appcmd.exe配置绑定解决了这个问题,可从目录“c:\ Windows \ System32 \ inetsrv”获取

“appcmd.exe set pp”WebsiteName / applicationName“/enabledProtocols:http,net.tcp”

注意:IIS配置是分层的,因此我们应该在尽可能低的级别更改配置,以避免其他应用程序出现不必要的更改/安全问题。

以下链接可能有所帮助: http://msdn.microsoft.com/en-us/library/ms788757.aspx http://support.microsoft.com/kb/2803161

希望这有帮助 阿尔伯特

答案 8 :(得分:0)

我在Windows 7上遇到相同的错误,并通过打开IIS进行了修复,右键单击保存您的应用程序的网站,然后选择“编辑绑定...”。我在这里添加了net.tcp绑定,问题已解决。

Site Bindings PrintScreen

答案 9 :(得分:-1)

<add baseAddress="net.tcp://localhost:8090" />

请在配置文件中进行编辑,如图所示