Hi,
I would like to host a Wcf Service, create in a Wcf service Library, in a Web Application.
I've already done the same thing with Web Service asmx :
using System.Reflection;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
namespace WebServiceLibrary
{
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class WebService1 : WebService, IHttpHandlerFactory
{
private static WebServiceHandlerFactory wshf = new WebServiceHandlerFactory();
private static MethodInfo coreGetHandlerMethod = typeof(WebServiceHandlerFactory).GetMethod("CoreGetHandler", BindingFlags.Instance | BindingFlags.NonPublic);
public System.Web.IHttpHandler GetHandler(System.Web.HttpContext context, string requestType, string url, string pathTranslated)
{
return (IHttpHandler)coreGetHandlerMethod.Invoke(wshf, new object[] { GetType(), context, context.Request, context.Response });
}
public void ReleaseHandler(IHttpHandler handler)
{
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
}
The web.config file of the Web Application :
<system.webServer>
<handlers>
<add name="WebService" path="WebService1.asmx" verb="*" preCondition="integratedMode" type="WebServiceLibrary.WebService1"/>
</handlers>
</system.webServer>
Is here a way to do the same thing with a Wcf Service ?
Regards.