Deploying Endpoint Addresses in WCF - wcf

Hello I am a bit confused with endpoints, I have been reading about them for a while now and just cant grasp it. So please forgive my lack of knowledge here.
Lets say i have an endpoint on both client and server.
<service name="MyProject.Server.Services.CustomerManager">
<endpoint address="net.tcp://localhost:5000/CustomerService"
binding="netTcpBinding" name="NetTcpBindingEndpoint" contract="HandHeld.ServerContracts.Contracts.ICustomerService" />
</service>
I have everything working tested and ready to deploy. I need to put the server app on a server that is called SQL. can someone please tell me what to change and why?

Related

I have created a simple WCF web services and when I hosted on a remote service I am getting the following error:

Error:
Could not find default endpoint element that references contract 'ServiceReference1.IService1' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
Can someone help me please with regards to the endpoint configuration?
When the service was running on the local machine the client was pointing at the following:
<endpoint name="BasicHttpBinding_IService1"
address="http://localhost:54651/Service1.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1"
contract="ServiceReference1.IService1" />
What do we need to write when the service is running on the web hosting service?
It looks like you're hosting it in IIS Express on your local/dev machine.
Are you also using IISExpress or IIS? Verify if the service on the remote machine can be accessed at http://localhost:54651/Service1.svc. Your port number might be different or the address may have to be changed completely when you installed it. Change the address in the configuration file to wherever the service actually is and it should work.
If it was working on your local machine - my guess is you made a classic edit error. The http://localhost:54651/Service1.svc" service address in your config file needs to be changed according to your service location and your client will need to point to that as well.
Just a guess..

WCF service application deployment

I am newbie to WCF. I have created one WCF Service Application having three services. I want to deploy it now, so I can access it from other computers. What steps should I follow?
Again it's WCF Service application not service library.
You can host your service on IIS as well as Windows Service. Following links might be help you.
[IIS Hosting]
http://msdn.microsoft.com/en-us/library/aa751792.aspx
[Windows Service]
http://msdn.microsoft.com/en-us/library/ms733069.aspx
And try this also,
http://www.codeproject.com/Articles/550796/A-Beginners-Tutorial-on-How-to-Host-a-WCF-Service
I used to thought that "WCF Application" cannot be deployed on IIS (Because in some articles I found that, advantage of WCF Service library over application is they can be deployed on IIS and in some other ways)
It is simple than I thought.
Just defined ABC's of service
<services>
<service name="HotelBookingServiceWcf.AdminService">
<endpoint contract="HotelBookingServiceWcf.IAdminService"
binding="basicHttpBinding"
address="mex">
</endpoint>
</service>
</services>
Went to IIS Manager
In left panel
Sites > Right Clieck > Add new site
Gave details and specified port number ok
To test it's working right click on .svc file and click on view in browser
It will open a web page if nothing's wrong you will see service page

net.tcp service is unavailable for the protocol of the address

Our application is hosted in IIS 7.0. It exposes endpoints over net.tcp protocol. But we kept running into the following exception:
EndpointNotFoundException: The message could not be dispatched because
the service at the endpoint address
'net.tcp://localhost/xxx/service.svc' is unavailable for the protocol
of the address.
We have checked the following places for possible causes.
Windows Process Activation Service is running OK
Net.Tcp Listener Adapter service is OK.
Net.Tcp Port Sharing service is OK.
We made net.tcp binding for the web application.
The net.tcp protocol is enabled for the web application as below.
I have tried to reset the IIS after checking all the above places. Still not working.
This is killing me. Hope someone could give me some hints.
I have searched a lot. Seems this is a very common issue which hasn't be perfectly solved. I think it's time to end this pain in ass.
Many thanks!
It is hard to say but on what port are you trying to connect?
Make sure that port is available and nothing else is using it.
If you are using a proxy you should add the below as well:
......
<httpTransport
maxBufferPoolSize="4194304"
maxBufferSize="1048576"
maxReceivedMessageSize="1048576"
proxyAddress="http://127.0.0.1.:8888
useDefaultWebProxy="false"
/>
</binding>
</customBinding>

No endpoint listening at net.pipe exception

I have many WCF services and I need to call one service from another. I decided to use netNamedPipeBinding for this purpose.
My web.config file looks like this. (I have not copied irrelevant stuff here.)
<services>
<service name="Services.AuthorizationService" >
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" >
<endpoint
name="AuthorizationService"
address=""
binding="basicHttpBinding" contract="ServiceContracts.IAuthorizationService" />
<endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc"
binding="netNamedPipeBinding" contract="ServiceContracts.IAuthorizationService"
name="AuthorizationNamedPipeEndpoint"/>
</service>
</Services>
The client section in the web.config file looks like this:
<client>
<endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc"
binding="netNamedPipeBinding" contract="ServiceContracts.IAuthorizationService" name="AuthorizationServiceNamedPipe" />
</client>
I am trying to call one of the OperationContracts (GetDetails) like this:
using (ChannelFactory<IAuthorizationService> authorizationChannel = new ChannelFactory<IAuthorizationService>("AuthorizationServiceNamedPipe"))
{
IAuthorizationService authorizationService = authorizationChannel.CreateChannel();
var response = authorizationService.GetDetails(new GetDetailsRequestMessage());
}
When I execute this code, I get the exception at the line I invoke the OperationContract GetDetails:
There was no endpoint listening at net.pipe://localhost/TestSite/AuthorizationService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
I am not able to find out the exact problem. There is no InnerException as well.
I am using Windows7 machine and IIS version is IIS7.5. Please note that I can call this service from my Winform application without any problem. net.pipe binding is added to the website bindings in the IIS.
How to ensure that the service is working properly using the net.pipe transport? In case of HTTP, we can browse in IE and ensure it.
This problem was solved after activating Windows Communication Foundation Non-HTTP Activation component from the Control Panel —> Programs and Features, and then click "Turn Windows Components On or Off" in the left pane. Expand the Microsoft .NET Framework 3.5.
When it's activated and you use non-HTTP binding, the WAS is automatically used.
I did a very basic & silly mistake but it helped me to learn many things. The following articles helped me a lot:
Extend Your WCF Services Beyond HTTP With WAS
Hosting WCF Services in Windows Activation Service
WCF gets Access denied when the consumer try invoke a WCF service calls hosted on Virtual Machine
The last link gave me a pointer that Server Certificate related configuration might be causing troubles. And I was adding a behavior (which is not seen in the question) for the service. That behaviour was using the Server Certificates.
We were getting the same issue in SharePoint 2013. Something happened during the install and the activation settings weren't turned on. I'm not sure if it was an issue with the application server feature or something else.
So thanks for the post! We were able to correct the SP 2013 problem too. Here's the exception we were seeing for those who might run into it also:
System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. --->
System.IO.PipeException: The pipe endpoint 'net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc' could not be found on your local machine.

WCF host address question

when I setup the wcf service on a web server, I set the end point address as
<endpoint address="http://www.mydomin.com/clientname/happy.svc"
binding="basicHttpBinding"
name="happysvcbasic"
contract="happysvc.Ihappysvc">
</endpoint>
but when type in above address on a browser, I get a different host name, which is the internal server name, such as,
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:
svcutil.exe http://internalservername.domain/clientname/happy.svc?wsdl
I tried to add the host/baseaddress tag, but make no difference, what I missed? thanks for help.
When you host via IIS your service in IIS the address is always relative. Assuming you want to achieve something with your endpoint remove the http://
<endpoint address="clientname"
And then your endpoint would be
http://localhost/virtualdirectory/happy.svc/clientname
The use for this is when you are exposing multiple endpoints, as each endpoint has to have a unique address.
See or This for more information.
If you are trying to setup a different dns address for your service you need to change the way you have hosted your website and use host headers.
When you host your WCF service in IIS, you do not get to choose the address, so setting an address= in your <endpoint> is absolutely useless, as is setting base addresses.
When hosting in IIS, the only things that determine your WCF service address are:
the IIS server machine name/IP address, plus possibly a port number
the virtual directory and possibly any subdirectories where your happy.svc file is located
the name of your *.svc file itself, including the .svc extension
So your WCF service address will be something like:
http://yourserver:80/VirtualDirectory/SubDirectory/happy.svc
That's all there is, and you can't change that (at least not now, in WCF 3.5 - it might be different in WCF in .NET 4).
So now: what is your question, really?