找不到与 net.tcp 方案匹配的基地址

发布于 2024-08-13 04:45:41 字数 4286 浏览 9 评论 0原文

我已将文件传输服务从 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中的虚拟目录/应用程序->管理应用程序-> 高级设置。并且,在“启用协议”部分中,添加 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: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>

我仍然无法在我的 Web 应用程序中引用我的 FileTransferServiceClient。

再次感谢。

I have moved my file transfer service from basicHttpBinding to netTcpBinding
as I am trying to set up a duplex mode channel. I have also started my net.tcp
port sharing service.

I am currently in dev and am self hosting on an xp box until we move the
app to a dev server. so, for now, I do not have access to IIS.

After configuring my service as such:

<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>

And, my binding as such:

<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>

I get the folloing error when I right and browser to the SVC file:

Could not find a base address that
matches scheme net.tcp for the
endpoint with binding NetTcpBinding.
Registered base address schemes are
[http].

The reading online suggests that, in order to fix this problem, i
needed to add the net.tcp binding to the binding of the application
in IIS. But, what do I do if I am self hosting and do not have access to
IIS?? By the way, if you are reading this and "do" have IIS, do the following:
Right click the virtual directory/application in IIS -> Manage application ->
Advanced settings. And, in the Enabled Protocols part, add net.tcp.

Any ideas?


UPDATE: I thought I had it working but it's still not working. Here is what I have now:
I am still getting the "could not find base address that matches scheme net.tcp" error.
I have changed all my base addresses to reflect your suggestion. Here is what I have now:

<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>

I have tried this with both "net.tcp://localhost:2544" & "net.tcp://localhost:8001".
Do I need to add (allow) something in my firewall settings? Any other suggestions?

Here is my filetransferservice's mexTcpBinding in my App.config file:

<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>

I am still unable to reference my FileTransferServiceClient in my web app.

Thanks again.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

风和你 2024-08-20 04:45:41

错误(WCF):
无法找到与绑定 NetTcpBinding 的端点的方案 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 激活

步骤 2:
IIS> WCF主机网站>管理应用程序>高级设置>启用协议>将值设置为HTTP、NET.TCP

Error (WCF):
Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http].

Step 1:
Note WAS (Windows Process Activation Service) or non-http protocol support, is only supported by following platforms:
• Windows Vista
• Windows 7
• Windows Server 2008

  1. Go to Turn Windows features on or off
  2. Go to Microsoft .NET Framework 3.5
  3. Check Windows Communication Foundation HTTP Activation
  4. Check Windows Communication Foundation Non-HTTP Activation

Step 2:
IIS > WCF Host Web Site > Manage Application > advanced Settings > Enabled Protocols > Set the value to HTTP,NET.TCP

江南月 2024-08-20 04:45:41

您只需为服务定义基地址(而不是整个地址),然后在服务端点中定义其余部分。 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 基地址上的元数据,您需要在 < 中公开一个 net.Tcp MEX 端点,如下所示/代码> 部分:

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

You need to define just the base address (not the whole address) for your service, and then the rest in the service endpoint. The address you have with the filetransfer.svc file at the end is not a valid base address (it's a file address, really)

<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>

With this, and using self-hosting, your service would be available at the complete address:

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

Since this is net.tcp and you're self-hosting, there's no need for a svc file at all.

UPDATE: if you want to be able to get metadata on your net.TCP base address, you'll need to expose a net.Tcp MEX endpoint like this inside your <service> section:

        <endpoint name="NetTcpMEX"
                  address="netTcpMex"
                  binding="mexTcpBinding"
                  contract="IMetadataExchange" />
桜花祭 2024-08-20 04:45:41

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

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

Space in "Enabled Protocols" entry in IIS => Select virtual Directory/application => advanced settings => Enabled Protocols. e.g. http, net.tcp. (Space between protocol text

This should be http,net.tcp (ie. no space between the protocol text)

猥琐帝 2024-08-20 04:45:41

经过大量解决方案后..我在此博客..但是我将在这里解释整个过程..您需要按照以下步骤操作..

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

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

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

检查第 2 步完成后您的问题是否得到解决。如果没有解决,请按照以下步骤操作

第 3 步:
在管理员级命令提示符窗口中,运行以下命令。

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

重新启动 IIS 一次,否则您可能会出现 无法映射路径 '/' 异常 现在

您的应用程序预先设置将如下所示

在此处输入图像描述

After going through a lots of solution .. i found the final solution in this blog.. however i am going to explain the whole procedure here .. you need to follow the below steps ..

Step1:
(Windows Process Activation Service) or non-http protocol support, is only supported by following platforms: • Windows Vista • Windows 7 • Windows Server 2008

  • Go to Turn Windows features on or off
  • Go to Microsoft .NET Framework 3.5
  • Check Windows Communication Foundation HTTP Activation
  • Check Windows Communication Foundation Non-HTTP Activation

Step 2:
IIS > WCF Host Web Site > Manage Application > advanced Settings > Enabled Protocols > Set the value to http,net.tcp

check if your problem solved after step2 completion..if not then follow below step

Step 3:
In an administrator-level Command Prompt window, run the following command.

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

Restart the IIS once or you could get Failed to map the path '/' exception now

Your application in advance setting will looks like below now

enter image description here

三月梨花 2024-08-20 04:45:41

对于未来的读者。

确保您使用 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 的端点的方案 net.pipe 相匹配的基地址。

然后您需要将“net.pipe”添加到列表中。

例子:

http、net.tcp、net.pipe

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

将 WCF 配置为托管在 IIS7 上的命名管道

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

(命名管道 Windows 服务)

NetPipeActivator

Net.Pipe Listener Adapter

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

(tcp windows 服务)

NetTcpActivator

Net.Tcp Listener Adapter

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

For future readers.

Make sure you not using IIS-Express.

This was my "gotcha".

Reference:

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.

This is a property under Visual Studio and the web.csproj (or similar) Properties and the "Web" left-tab. There is a checkbox called "Use IIS Express". Uncheck that.

After you do that, you'll still have to go to IIS(7) and "http,net.tcp" for "Enabled Protocols" (as described in other answers here)

Also, if you're getting the named pipe specific error.

Could not find a base address that matches scheme net.pipe for the endpoint with binding NetNamedPipeBinding.

Then you need to add "net.pipe" to the list.

Example:

http,net.tcp,net.pipe

Also see the below for the named pipe specific error.

Configure WCF as Named Pipe hosted on IIS7

ALSO: Check these corresponding windows services (named pipes or tcp or both)

(named pipes windows service)

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.
淡淡離愁欲言轉身 2024-08-20 04:45:41

请从控制面板 -> 安装“非 Http 激活”窗口组件节目->打开或关闭窗口 ->特点->添加功能-> .net 框架.* 功能 -> Wcf激活->非 Http 激活。

Please install "Non-Http activation" window component from Control Panel -> Programs -> Turn Window On or off -> Features -> Add features -> .net framework .* features -> Wcf activation -> Non-Http Activation.

心凉 2024-08-20 04:45:41

适用于 Windows 10
步骤 1:转至打开和关闭 Windows 功能 > .Net Framework 4.6 高级服务> WCF服务> TCP激活

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

步骤3:使用管理权限打开命令控制台>类型iisreset

For Windows 10
Step 1: Go to Turn Windows features on and off > .Net Framework 4.6 Advanced Services > WCF Services > TCP Activation

Step 2: IIS > WCF Host Web Site > Manage Application > advanced Settings > Enabled Protocols > Set the value to net.tcp,http

Step 3: Open command console with administrative rights > type iisreset

ぃ双果 2024-08-20 04:45:41

我遇到了同样的问题(环境: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

希望有所帮助
阿尔伯特

I had the same problem (Environment: Win7/IIS7.5 .NET4) and I solved it by configuring the binding through appcmd.exe, available form the directory "c:\Windows\System32\inetsrv"

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

note: IIS configuration is hierarchical and consequently we should change config at the lowest possible level to avoid unwanted changes/security issues on other applications.

The following links may help:
http://msdn.microsoft.com/en-us/library/ms788757.aspx
http://support.microsoft.com/kb/2803161

Hope this help
Albert

一抹微笑 2024-08-20 04:45:41

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

网站绑定 PrintScreen

I had the same error on a Windows 7 and fixed it by opening IIS, right click on the website that holds your application and select 'Edit Bindings...'. I added here the net.tcp binding and the problem was solved.

Site Bindings PrintScreen

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

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

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

Please Edit it in the Config file as Shown

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文