0
我需要在IIS上托管web服务。我之前做过这个,我将有一个.svc(WCF)文件或amsx文件。但从来没有只是一个DLL。我应该如何设置它?如何使用dll在IIS上托管web服务
我需要在IIS上托管web服务。我之前做过这个,我将有一个.svc(WCF)文件或amsx文件。但从来没有只是一个DLL。我应该如何设置它?如何使用dll在IIS上托管web服务
创建像这样使用asp.net兼容模式一类...
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class MyService
{
//Some methods
}
注册类在Global.asax文件作为Web服务
public class Global : System.Web.HttpApplication
{
public void Application_Start(object sender, EventArgs e)
{
RegisterRoutes();
}
private static void RegisterRoutes()
{
RouteTable.Routes.Add(new ServiceRoute("myServiceUrl", new WebServiceHostFactory(), typeof(MyService)));
}
}
如果您的应用程序正在运行在端口8080上,您可以点击服务
http://localhost:8080/myServiceUrl