I've got a WCF service that uses a Global.asax file to activate my services. So, my deplo开发者_JAVA百科yed virtual directory on my deployment box looks like
web.config global.asax - which contains Services.dll and Services.pdb
the Services.dll is the compiled bits of my Service.svc and Service.svc.cs files.
How do I get this setup to work in IIS6? My Global.asax looks like:
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes();
}
private void RegisterRoutes()
{
WebServiceHostFactory factory = new WebServiceHostFactory();
RouteTable.Routes.Add(new ServiceRoute("MyService", factory, typeof(MyService)));
}
}
Any ideas? This works in IIS7 such that I can navigate to http://server/MyService/...
AFAIK Unfortunately in IIS6, you need to decide on an extension to use so that your url is http://server/MyService.extension. Then you need to register that extension in IIS6 to be handled by ASP.NET.
We use .mvc, so our urls look like http://server/MyService.mvc. We're moving to IIS7 shortly so we kinda just stuck to that for now, so there may be a better way.
精彩评论