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

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.

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

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

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)

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

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.

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

<add baseAddress="net.tcp://localhost:8090" />
Please Edit it in the Config file as Shown

Related

WCF Endpoint connection fail

I'm using WCF to do IPC communication between two processes.
The settings below are the endpoint settings set on the server side.
<services>
<service name="IPC.Server.SessionService">
<endpoint address="net.pipe://localhost/TestSessionService" binding="netNamedPipeBinding" bindingConfiguration="" contract="IPC.ISessionService" />
</service>
</services>
And the settings below are the endpoint settings set on the client.
<client>
<endpoint address="net.pipe://localhost/TestSessionService" binding="netNamedPipeBinding" bindingConfiguration="" contract="IPC.ISessionService" name="SessionServiceClient" kind="" endpointConfiguration="" />
</client>
The problem is that if the server program is started with administrator privileges, IPC communication succeeds, but if it is started with normal user privileges, endpoint connection from the client fails.
The client program has normal privileges.
I googled for a while, but couldn't find any specific information.
I checked by leaving a debug log, and the server program succeeded in creating an endpoint even with normal privileges.
In other words, the problem is that the client cannot connect to the endpoint created with normal privileges.
Thank you for help.
PS) This is the error message from client (japanese and english)
<Message=メッセージを受信できる net.pipe://localhost/TestSessionService でリッスンしているエンドポイントがありませんでした。これは一般に、アドレスまたは SOAP アクションが正しくない場合に発生します。詳細については、InnerException を参照してください (ある場合)。>
<Message=There was no endpoint listening on net.pipe://localhost/TestSessionService that could receive messages. This generally happens when the address or SOAP action is incorrect. See InnerException for details, if any. >
As far as I know, administrative privileges are only needed for the HTTP URL namespace reservations. NetNamedPipeBinding does not require administrator privileges.
If not, try WSDualHttpBinding and allow the user to reach the common namespace.

Communicate Azure App Service to locally hosted IIS WCF Service [duplicate]

I'm building an ASP.NET website - it's a solution with a few projects, a data base and a web service. Everything worked fine, but last time I tried to run the project, I got the following error:
There was no endpoint listening at http://localhost:[number]/BooksWS.svc that could accept the
message. This is often caused by an incorrect address or SOAP action. See InnerException,
if present, for more details.
The inner exception says:
Unable to connect to the remote server
This error sort of came out of the blue, so I'm not sure what additional information I should provide. Does anyone have any idea why this could happen?
I suppose even a general answer could help, the only info I found about this error in the web concerned WCF.
go to webconfig page of your site, look for the tag endpoint, and check the port in the address attribute, maybe there was a change in the port number
Another case I just had - when the request size is bigger than the request size set in IIS as a limit, then you can get that error too.
Check the IIS request limit and increase it if it's lower than you need.
Here is how you can check and change the IIS request limit:
Open the IIS
Click your site and/or your mapped application
Click on Feature view and click Request Filtering
Click - Edit Feature Settings.
I just found also another thread in stack
IIS 7.5 hosted WCF service throws EndpointNotFoundException with 404 only for large requests
An another possible case is make sure that you have installed WCF Activation feature.
Go to Server Manager > Features > Add Features
I had this problem when I was trying to call a WCF service hosted in a new server from a windows application from my local. I was getting same error message and at end had this "No connection could be made because the target machine actively refused it 127.0.0.1:8888". I donot know whether I am wrong or correct but I feel whenever the server was getting request from my windows application it is routing to something else. So I did some reading and added below in Web.config of service host project. After that everything worked like a magic.
<system.net>
<defaultProxy enabled="false">
</defaultProxy>
</system.net>
Short answer but did you have Skype open? This interferes specifically with ASP.NET by default (and localhosts in general) using port:80.
In Windows: Go to Tools -> Options -> Advanced -> Connection and uncheck the box "use port 80 and 443 as alternatives for incoming connections".
Try this:
Delete the service instance.
Create a new instance of the service.
Sometimes the port is changed and generated error.
I tried a bunch of these ideas to get HTTPS working, but the key for me was adding the protocol mapping. Here's what my server config file looks like, this works for both HTTP and HTTPS client connections:
<system.serviceModel>
<protocolMapping>
<add scheme="https" binding="wsHttpBinding" bindingConfiguration="TransportSecurityBinding" />
</protocolMapping>
<services>
<service name="FeatureService" behaviorConfiguration="HttpsBehavior">
<endpoint address="soap" binding="wsHttpBinding" contract="MyServices.IFeature" bindingConfiguration="TransportSecurityBinding" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="HttpsBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="TransportSecurityBinding" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
If you are using custom binding, please make sure that you are putting the same name for both custom binding (Server and Client)in config files
<bindings>
<customBinding>
<binding name="BufferedHttpServerNoAuth" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00">
<gzipMessageEncoding innerMessageEncoding="textMessageEncoding" MaxArrayLength="10485760" MaxBytesPerRead="31457280" MaxStringContentLength="102400000" />
<httpsTransport hostNameComparisonMode="StrongWildcard" manualAddressing="False" maxReceivedMessageSize="31457280" authenticationScheme="Anonymous" bypassProxyOnLocal="True" realm="" useDefaultWebProxy="False" />
</binding>
</customBinding>
</bindings>
the binding name "BufferedHttpServerNoAuth" should be same in both.
Hope this would help someone
This is ancient history but I just ran into this issue and the fix for me was recycling the application pool of the website in IIS. Easy fix, for once.
I changed my website and app bindings to a new port and it worked for me. This error might occur because the port the website uses is not available. Hence sometimes the problem is solved by simply restarting the machine
-Edit-
Alternative (and easier) solution:reference
Get PID of process which is using the port
CMD command-
netstat -aon | findstr 0.0:80
Use the PID to get process name -
tasklist /FI "PID eq "
Open task manager, find this process and stop it.
(Note- Make sure you do not stop Net.tcp services)
I solved it by passing the binding with endpoint.
"http://abcd.net/SampleFileService.svc/basicHttpWSSecurity"
Click on Service which you have created right click on it then select update references after this rebuild the application it will work

To involve SharePoint WCF Service with SSL-Certificate from Client laptop failed

My testing environment is:
1* Server :: SharePoint Site with WCF Service (in the ISAPI folder) and we configured the SSL and Cert on it.
1* Client :: Windows 10 with one Console Application to involve the WCF service
Testing (1) :all programs (WCF Service and Console Application) on the SharePoint Server
I created a Console application to invoke the WCF Service in SharePoint. Meantime, the Console application and WCF are on the same server. the outcome is everything works properly. It is successful to upload file into a Document Library.
Testing (2) :to simulate my client environment:
1* SharePoint :WCF Service
1* Windows 10 :Console application
the outcome failed and I got the error message:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'
To be honest, I stuck here for a while. I also list out a portion of my source code for someone of experience to look at. I also posted some sample code and web.config in here.
Updated.
If we enable NTLM authentication, we have to enable the windows authentication.
Then when calling the service, we need to provide windows credential.
//it will use the binding and service endpoint address in the system.servicemode section.
ServiceReference1.ServiceClient client = new ServiceReference1.ServiceClient();
//windows account on the server.
client.ClientCredentials.Windows.ClientCredential.UserName = "administrator";
client.ClientCredentials.Windows.ClientCredential.Password = "abcd1234!";
try
{
Console.WriteLine(client.SayHello());
}
catch (Exception)
{
throw;
}
Auto-generated configuration.
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService">
<security mode="Transport">
<transport clientCredentialType="Ntlm" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://vabqia969vm:21011/" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IService" contract="ServiceReference1.IService"
name="WSHttpBinding_IService">
<identity>
<userPrincipalName value="VABQIA969VM\Administrator" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Feel free to let me know if the problem still exists.

Azure Service bus to WCF

I am running into issues while trying to run a WCF REST service that will connect to an Azure Service bus. My web.config contains the following:
<system.serviceModel>
<services>
<service name="helloSB.SomeService">
<endpoint contract="helloSB.ISomeService"
binding="webHttpRelayBinding"
address = "" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:7200/mySB/helloSB.SomeService/" />
</baseAddresses>
</host>
Whenever I try to send a message to WCF, I receive:
The service /mySB/SomeService.svc cannot be activated due to an exception during compilation. The exception is : Unable to reach localhost via TCP (9351, 9352) or HTTP (80,443).
Why can't I use a non-standard port?
Looks like these are related to some port issues. The below link provides additional details on troubleshooting steps.
http://social.technet.microsoft.com/wiki/contents/articles/2055.troubleshooting-connectivity-issues-in-the-azure-appfabric-service-bus.aspx

WPF Client with WCF Service from Localhost dev to prod server?

I am just starting to learn WCF. I have successfully set up a WCF service with host console app. The service maps to SQL Server with Entity Framework. I then have a WPF client app which consumes the service. This all works fine in Dev, both the service and client app running from my machine:
<endpoint address="http://localhost:8081/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IRegimesService" contract="RegimesService.IRegimesService"
name="BasicHttpBinding_IRegimesService" />
I have now transferred the service and host onto my new VM. The service host runs fine. I am now trying to configure the client app endpoint to connect to the service. I think the HTTP address is incorrect:
Service app.config:
<services>
<service name="diiRegimesService.RegimesService">
<endpoint address="" binding="basicHttpBinding" contract="diiRegimesService.IRegimesService"/>
<host>
<baseAddresses>
<add baseAddress="http://localhost:8082" />
</baseAddresses>
</host>
</service>
</services>
Client app.config:
<client>
<endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IRegimesService" contract="RegimesService.IRegimesService"
name="BasicHttpBinding_IRegimesService" />
</client>
The server credentials for remote desktop are: emea-myserver01.emea.basketballinfo.com
I currently don't specify a username & password in my client app.config.
The service is running on the server. I'm getting an exception trying to add the service reference in the client app.
Add Service Reference- Adress: http://EMEA-myserver01.emea.basketballinfo.com
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://emea-myserver01.emea.basketballinfo.com/'.
You need to make sure the server is able to resolve the full domain name.
Also, the address url provided in the client configuration snippet <endpoint address="http://emea-myserver01.emea.basketballinfo.com/localhost:8082/ does not seem valid. Perhaps you want to use <endpoint address="http://emea-myserver01.emea.basketballinfo.com:8082/

Categories