本文介绍了找不到匹配方案的net.tcp的基址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提出我的文件传输服务从basicHttpBinding的到NetTcpBinding的
因为我想建立一个双工模式的通道。我也开始了我的net.tcp
端口共享服务。

I have moved my file transfer service from basicHttpBinding to netTcpBindingas I am trying to set up a duplex mode channel. I have also started my net.tcpport sharing service.

我目前在开发和我的自我托管在一个XP的方块,直到我们移动
应用到开发服务器。所以,现在,我没有访问IIS。

I am currently in dev and am self hosting on an xp box until we move theapp 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>

和,我这样绑定:

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

我得到的folloing错误,当我的权利和浏览器的SVC文件:

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

找不到一个基址
  匹配方案的net.tcp为
  与绑定NetTcpBinding的端点。
  注册基址方案是
  [HTTP]

读取在线表明,为了解决这个问题,我
添加net.tcp绑定到应用的结合需要
在IIS。但是,做我做,如果我的自我托管和没有访问
IIS?顺便说一句,如果你正在读这篇文章,做有IIS,请执行以下操作:
右键单击IIS虚拟目录/应用程序 - >管理应用程序 - >
高级设置。并且,在启用的协议的一部分,加的net.tcp。

The reading online suggests that, in order to fix this problem, ineeded to add the net.tcp binding to the binding of the applicationin IIS. But, what do I do if I am self hosting and do not have access toIIS?? 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.

任何想法?


更新:我想我有它的工作,但它仍然没有工作。以下是我现在有:
我仍然得到错误的匹配方案的net.tcp找不到基址。
我已经改变了我所有的基址,以反映您的建议。以下是我现在有:

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>

我曾与两个尝试这一的net.tcp://本地主机:2544&放大器; 的net.tcp://本地主机:8001。
我是否需要添加(允许)东西在我的防火墙设置?任何其他建议?

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?

下面是我filetransferservice的mexTcpBinding在我的App.config文件:

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>

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

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

再次感谢。

推荐答案

您需要为您服务的定义只是在基址(而不是在地址)和那么剩下的服务端点。你有在年底 filetransfer.svc 文件中的地址是不是有效的基地址(这是一个文件地址,真的)

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

由于这是和的net.tcp你是自托管的,没有必要对SVC档案。

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

更新:如果您希望能够得到您的net.tcp的基址元数据,你需要使您的&LT;服务与GT; 部分:

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

这篇关于找不到匹配方案的net.tcp的基址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 12:50
查看更多