I have a simple WCF service with small logic like
Add(int x, int y)
Sub(int x,int y)
Mul(int x,int y)
Div(int x,int y)
Now I hosted the service using IIS and Self Hosting(using ServiceHost class)
Now I want to host the servcice with WAS.
How do I proceed..I don't have any idea about WAS..???
You should refar this Links:
How to: Host a WCF Service in a Managed Windows Service
this is for how to host wcf service in WAS
Related
I know how to make wcf service server to run on iis.
But i need to host my wcf server on something like iis but the service will be available only when my application is up and running.
I know that it is possible to create application that will act like a wcf host.
But in this case i will not have the access from other machine ( right ? ) to this service because as far as i know .. the access to this service from other machine can be done only when the wcf service is running from iis.
Any help please ...
10x
Hosting WCF service has three different types:
Hosting in IIS
Hosting in Managed Application
Hosting in Windows Service
But in this case I will not have the access from other machine ( right
? ) to this service because as far as I know .. the access to this
service from other machine can be done only when the WCF service is
running from IIS.
If you thought that only the WCF service hosted in IIS is accessible outside that machine where service is hosted. You are completely wrong. As long as your service is up and running and your machine has Public IP address you can access it every where.
I have a .NET 4.0 WCF service that's implemented with the Dependecy Injection pattern using Castle Windsor (v3). The service is hosted in IIS 7 and I use the Visual Studio Development Server when running locally. My dev server assigns a specific port to the service.
Now, if I don't add a base address I will get an exception from Castle Windsor saying:
Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [].
But, if I do assign a localhost address with the same port as my developer server, I get a port conflict.
Why do I need a base address in this case, and how do I handle the port conflict?
Here's my Castle Windsor-related code. The container is created in my Application_Start() in the Global.asax.cs file.
public class ServiceInstaller : IWindsorInstaller
{
public void Install(IWindsorContainer container, IConfigurationStore store)
{
container.AddFacility<WcfFacility>()
.Register(Component.For<IMyService>().ImplementedBy<MyService>().AsWcfService<IMyService>().IsDefault()
);
}
}
Also, I'm not interested in hosting several services, there's just one.
Here's the answer, credited Craig Neuwirt from the Castle Project Google Group.
If it's being hosted in IIS you probably need to mark it as hosted so it should look something like
container.AddFacility<WcfFacility>()
.Register(Component.For<IMyService>().ImplementedBy<MyService>().AsWcfService(new DefaultServiceModel().Hosted()).IsDefault()
And for the record, my configuration was set up as suggested by Sir Hally, and that's when the port conflict appeared. With the additional fluent configuration above, I removed the base address configuration from the web.config.
Could you show your config?
If you host your service on IIS, the base address depends on site, application and port (according to IIS binding for current protocol - net.tcp, http).
You can user Visual Studio Development Server for http-based services (not net.tcp).
You can specify base address in config for VS DevelopmentService (inside your <service> tag)
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/MyApp/Service.svc"/>
</baseAddresses>
</host>
Hosting env : Windows 2003 server
IIS : 6.0
Dev env : Windows XP
IIS : 5.1
Scenario:
Client will be pushing some message into MSMQ and WCF service will be the one keeping an eye on MSMQ. Once the message is pulled from MSMQ WCF service will process and then put the data/message on to some other MSMQ.
We are thinking of creating a WCF service with NetMSMQ binding.
I have heard that if we are using IIS 6.0 we wont be able to host the WCF service with MSMQ binding, am I right? So for that reason are we supposed to host it as console app or windows service?
thanks
That is correct - hosting in IIS 5/6 only works for HTTP protocols / bindings. If you want to use MSMQ, you'll have to host it yourself - in a console app or a Windows NT Service.
IIS7 on Vista/Server 2008/Win7/Server 2008R2 supports MSMQ through the Windows Process Activation Service (WAS).
Marc
How to host WCF services locally instead of http binding.. I mean the services should be hosted within the .NET environment and not by using http or netTCP.. Could you please help me with the configuration for the same?
What are you trying to achieve here that can't be performed by using http or tcp settings for the local machine for both ends of the WCF contract? WCF isn't just between machines, you can also set it to communicate between different processes on the same machine.
I think you are confusing between hosting a WCF service and a WCF binding. A WCF service can be hosted in many different applications such as standalone executables, windows services, a web server such as IIS, ...
Once you've found an appropriate host for the service you have to decide what binding to use. A binding is used to specify the transport, encoding, and protocol details required for clients and services to communicate with each other.
Note that choosing a host could further limit the choice of bindings available. For example if you decide to host your service in IIS you could only use HTTP/S as transport and NetTcp is not available (in IIS7 it is available through WAS).
How to confgiure NetNamedPipeBinding.
How to: Host a WCF Service in a Managed Windows Service.
I have created a WCF service with NetMsmqBinding, and hosted it in IIS7 using Windows Activation Service (WAS).
Current (works perfectly):
Hosted in IIS at: http://localhost/MyService/MyService.svc
With the service endpoint address: http://localhost/private/MyService/MyService.svc
And the corresponding queue: .\private$\MyService/MyService.svc
Desired (does nothing, not even an error message):
Hosted in IIS at: http://localhost/MyService.svc
With the service endpoint address: http://localhost/private/MyService.svc
And the corresponding queue: .\private$\MyService.svc
Everything works perfectly when I use the MyService IIS application. But the same setup (code, IIS security, queue security, etc.) does nothing when I try to use the root "/" app instead of the "MyService" app to host the service. I don't get any errors in the Event Log. The incoming messages just sit in the queue.
Is hosting a WAS-activated service supported in in the root application of an IIS7 site?
I found a bug whereby hosting WCF services in the root (spent a lot of time on the phone with MSFT Support), thus host them in an application.
For example, I have a netMsmqBinding service hosted in IIS7, it is configured for WAS and it is hosted in the default site as:
http://mymachine/msmqtest/service.svc
The queue name for MSMQ needs to be called:
"msmqtest/service.svc"
And the endpoint in the config needs to be:
net.msmq://mymachine/private/msmqtest/service.svc
Also, make sure you are using the machine name in the config, NOT a host header name or something. MSMQ works from computer to computer, very important.
Hosting of WAS Activated Services do work rooted. I'm not 100% sure about the netMsmqBinding. the end point would need to be http://localhost/service.svc not /private though.