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
Related
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..
i have hosted my WCF service in IIS and have following endpoints configured
<endpoint name="MainService" contract="Docs.ICalculatorService" address="http://localhost:49495/WcfService1/service.svc" binding="wsHttpBinding">
</endpoint>
<endpoint name="MainTcpService" contract="Docs.ICalculatorService" address="net.tcp://localhost:49496/WcfService1/service.svc" binding="netTcpBinding">
</endpoint>
i have hosted my WCF service on port no 49495 which is real ,
now i have configured another endpoint which is using port no 49496
do i need to host this WCF service on another port 49496 or i am missing something
getting this error when looked in stack trace
The ChannelDispatcher at 'net.tcp://localhost:49495/WcfService1/service.svc' with contract(s) '"ICalculatorService"' is unable to open its IChannelListener
i have configured Endpoints and Configured Bindings in IIS 7
but now i am getting a new error
You have tried to create a channel to a service that does not support .Net Framing. It is possible that you are encountering an HTTP endpoint.**
As shabulator says, you need to enable the non-http service activator.
In case this isn't clear to anyone stumbling across this, this is a Windows feature you need to switch on.
On Windows 7 (Server 2008 will be similar) under Control Panel -> Programs you will see "Turn Windows features on or off". This brings up a dialog as the one shown.
Under Microsoft .NET Framework 3.5.1 tick the two boxes to install the features.
When I did this, it had the side effect of putting .NET 3.5 onto the server, which I didn't want as I was using a later version.
If this happens, open a command prompt and go to the .NET 4.0.30319 folder and run the aspnet regiis tool.
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -iru
My basic question is for guidance hosting a WCF service in IIS7 (2008 R2) on the default net.tcp port of 808 on a website other than "Default Web Site". I have 4 sites each bound to a specific IP address. I would like my WCF services to be hosted within a site other than the default using port 808. What is the catch here? I want to understand this without just using another port to solve the issue if that would even be the case.
I created this running question/log of trying to figure this out yesterday, but I just didn't have much luck. I had to move the WCF services back to the default website and move the net.tcp binding from my desired website back to the default as well.
moved net.tcp WCF services from localhost to IP address on new site, services won't load
I access my services using the technique of:
MyServiceClient : ClientBase<IMyService>, IMyDataService
and within the methods of the client:
return base.Channel.MyOperation(request);
I rely on the WCF configs in web.config of the hosting projects providing the .svc file to properly connect me to the WCF services. If this is sub-optimal, I am willing to change.
A typical client configuration in web.config looks as such:
<endpoint name="myServiceClient" address="net.tcp://localhost/MyServiceWebHost/MyService.svc/tcpEndpoint" binding="netTcpBinding" bindingConfiguration="myServiceNetTcpBinding" contract="Contracts.ServiceContracts.IMyService" />
Thanks for any pointers.
Its rights issue. Right click on your new website --> then Edit Permissions. On properties window click security tab and Edit button. Then Add IIS_IUSRS and give Read & execute, List folder contents, Read permissions. Now you can host and connect net tcp on new website.
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.
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?