WCF REST Toolkit이 더이상 호스팅이 안되는것 같다.
계속 써도 되겠지만, WCF 서비스를 호스팅할때, url의 .svc가 거슬리면, 아래 코드로 떼버리고 REST스따일로 사용하면 됨.
아니면 RouteTable을 통해서, 해도됨.

public class RestModule : IHttpModule   
{
    public void Dispose() {}
    public void Init(HttpApplication app)
    {
        app.BeginRequest += delegate {
            HttpContext ctx = HttpContext.Current;
            string path = ctx.Request.AppRelativeCurrentExecutionFilePath;
           
            int i = path.IndexOf('/', 2);
            if(i>0)
            {
                string svc = path.Substring(0, i) + ".svc";
                string rest = path.Substring(i, path.Length - i);
                ctx.RewritePath(svc, rest, ctx.Request.QueryString.ToString(), false);
            }
        };
    }
}

+ Recent posts