jquery with wcf not hosted on IIS
Is it possible to have jquery talk to my wcf service that is hosted as a window service? or it really needs to be hosted on IIS?
Also my regular wcf service don't have all this WebInvoke, AspNetCompatibilityRequirements. In it's current state can I use jquer开发者_如何学编程y to talk to my current wcf without making changes to it?
For example,
public interface IMyService
{
[OperationContract]
string SayHello();
}
public class MyService : IMyService
{
public string SayHello(){ return "Hello"; }
}
Technically speaking you can, but it will be a little complex thing. It will technically amount to convert your windows service to a http listener. To do so :
- Stop IIS server
- Configure your Windows Service to use tcpBindings over Soap
- The Windows Service should be bound to port 80 (HTTP)
- Start the Windows Service. Make a normal call from browser to see how it works. It should allow exchanged of Xml over Soap.
You can also refer to this question where the user is able to implement a Windows Service over HTTP.
精彩评论