簡體   English   中英

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

[英]Could not find a base address that matches scheme 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 文件時,出現以下錯誤:

找不到與綁定 NetTcpBinding 的端點的方案 net.tcp 匹配的基地址。 注冊的基地址方案是 [http]。

網上的閱讀建議,為了解決這個問題,我需要將net.tcp綁定添加到IIS中應用程序的綁定中。 但是,如果我是自托管並且無法訪問 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 文件中的文件傳輸服務的 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。

再次感謝。

錯誤 (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

您只需要為您的服務定義基地址(而不是整個地址),然后在服務端點中定義其余地址。 你在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" />

IIS 中“啟用的協議”條目中的空間 => 選擇虛擬目錄/應用程序 => 高級設置 => 啟用的協議。 例如http、net.tcp (協議文本之間的空格

這應該是http,net.tcp (即協議文本之間沒有空格)

在經歷了很多解決方案之后..我在這個博客中找到了最終的解決方案..但是我將在這里解釋整個過程..你需要按照以下步驟..

步驟 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: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 '/'異常

您的應用程序預先設置現在將如下所示

在此處輸入圖片說明

對於未來的讀者。

確保您沒有使用 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 或兩者)

(命名管道窗口服務)

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.

請從控制面板 -> 程序 -> 打開或關閉窗口 -> 功能 -> 添加功能 -> .net 框架安裝“非 Http 激活”窗口組件 * 功能 -> Wcf 激活 -> 非 Http 激活。

對於 Windows 10
步驟 1:轉到打開和關閉 Windows 功能 > .Net Framework 4.6 高級服務 > WCF 服務 > TCP 激活

第 2 步:IIS > WCF 主機網站 > 管理應用程序 > 高級設置 > 啟用協議 > 將值設置為 net.tcp,http

第 3 步:使用管理權限打開命令控制台 > 鍵入 iisreset

我遇到了同樣的問題(環境:Win7/IIS7.5 .NET4),我通過通過 appcmd.exe 配置綁定解決了它,可從目錄“c:\\Windows\\System32\\inetsrv”獲得

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

注意:IIS 配置是分層的,因此我們應該在盡可能低的級別更改配置,以避免其他應用程序發生不必要的更改/安全問題。

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

希望這有助於阿爾伯特

我在 Windows 7 上遇到了同樣的錯誤,並通過打開 IIS 來修復它,右鍵單擊包含您的應用程序的網站並選擇“編輯綁定...”。 我在這里添加了 net.tcp 綁定,問題就解決了。

網站綁定 PrintScreen

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

請在配置文件中編輯它,如圖所示

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM