【发布时间】:2012-07-11 11:48:18
【问题描述】:
我做了一个简单的 WCF Rest 服务。在我的 Global.asax 中,我注册了路线,例如
private void RegisterRoutes()
{
RouteTable.Routes.Add(new ServiceRoute("Test", new WebServiceHostFactory(), typeof(Test)));
RouteTable.Routes.Add(new ServiceRoute("Account", new WebServiceHostFactory(), typeof(Account)));
}
这意味着当我转到http://192.168.0.1/Test/HelloWorld 时,我会调用Test 类中的方法HelloWorld。但是如果我去http://192.168.0.1,我会收到http 403.14 Forbidden 消息。我想将 / 映射到 /Test。是否可以?我尝试将“Test”替换为“*”和“”,但如果我这样做,所有调用都会转到 Test...
【问题讨论】:
-
啊,这就是为什么我没有得到很多答案的原因......谢谢。
标签: .net wcf rest asp.net-mvc-routing