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

10

35

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.

Freehearted answered 24/11, 2009 at 21:43 Comment(2)
well, with baseAddress="net.tcp://localhost:2544/filetransfer/" and address="filetransfer" on your endpoint, your complete URL will be "net.tcp://localhost:2544/filetransfer/filetransfer" - did you try to connect there??Mandie
Thanks - silly oversight. I normally had "soap" there and changed it back. I spent the past hour going over my App.config and Web.config files with a fine-toothed comb and finally got it to compile. When I "add service reference", I am able to reference ../trade/mex and .../auth/mex but my net.tcp .../filetransfer/mex never shows up as an option. So, everything compiles nicely except I cannot access the FileTransferServiceClient from my Web App. Any idea why .../filetransfer/mex is not showing up? I am using mexTcpBinding and have posted what it looks like in my question. Thanks again.Freehearted
M
26

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" />
Mandie answered 24/11, 2009 at 21:47 Comment(4)
Looks like I am still getting this error. I tried your suggestion but that didn't seem to do it. I updated my question - any other suggestions? Thanks again.Freehearted
Hey, thanks again. I am able to compile my code now but can't seem to add my net.tcp service in the service references UI. Also, I have <serviceMetadata httpGetEnabled="True"/> for the service. When I try to navigate to my url: "net.tcp://localhost:2544/filetransfer/soap" in the browser it tells me that "firefox doesn't know how to open this address". When I try to browse from the filetransfer.svc file (I know it isn't necessary) I get the familiar: "Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding."Freehearted
OK, this is resolved (and thanks for your answer). I have a related issue but I will repost. Thanks again.Freehearted
@CodeSherpa, please advise how you got the "Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding". I have tried this answer and it is not workingAmbros
F
44

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

Factoring answered 15/5, 2012 at 7:11 Comment(2)
Thanks Amir. Second step was the one which helped me.Elijah
Step 2 was more problem: Used powershell to solve https://mcmap.net/q/428523/-iis-7-enabled-protocolsJurassic
M
26

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" />
Mandie answered 24/11, 2009 at 21:47 Comment(4)
Looks like I am still getting this error. I tried your suggestion but that didn't seem to do it. I updated my question - any other suggestions? Thanks again.Freehearted
Hey, thanks again. I am able to compile my code now but can't seem to add my net.tcp service in the service references UI. Also, I have <serviceMetadata httpGetEnabled="True"/> for the service. When I try to navigate to my url: "net.tcp://localhost:2544/filetransfer/soap" in the browser it tells me that "firefox doesn't know how to open this address". When I try to browse from the filetransfer.svc file (I know it isn't necessary) I get the familiar: "Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding."Freehearted
OK, this is resolved (and thanks for your answer). I have a related issue but I will repost. Thanks again.Freehearted
@CodeSherpa, please advise how you got the "Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding". I have tried this answer and it is not workingAmbros
A
18

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)

Actinozoan answered 4/3, 2014 at 2:50 Comment(0)
M
10

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

Morehouse answered 16/3, 2016 at 8:43 Comment(0)
F
9

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.
Ferreous answered 19/12, 2014 at 20:47 Comment(0)
D
5

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.

Dystrophy answered 8/8, 2011 at 11:0 Comment(0)
D
3

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

Drinkable answered 24/3, 2016 at 19:34 Comment(0)
C
1

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

Cynicism answered 31/5, 2013 at 12:20 Comment(0)
C
0

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

Cooke answered 9/5, 2019 at 8:11 Comment(0)
H
-1
<add baseAddress="net.tcp://localhost:8090" />

Please Edit it in the Config file as Shown

Hyperextension answered 8/3, 2021 at 7:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.