Could not find a base address that matches scheme net.tcp

穿精又带淫゛_ 提交于 2019-11-27 08:14:52

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

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

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)

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.

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

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.

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

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

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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!