简体   繁体   English

VS 2012:RouteTable.Routes.Add不起作用?

[英]VS 2012: RouteTable.Routes.Add doesn't work?

I have a WCF REST service project in VS 2010 where I change RouteTable at application startup adding a route: 我在VS 2010中有一个WCF REST服务项目,我在应用程序启动时更改RouteTable并添加了一条路线:

RouteTable.Routes.Add(new ServiceRoute("AppServer", new WebServiceHostFactory(), typeof(MyService))); RouteTable.Routes.Add(new ServiceRoute(“ AppServer”,new WebServiceHostFactory(),typeof(MyService)));

It worked in vs 2010 and when running in in development server I could call methods from a browser like: 它在vs 2010中工作,在开发服务器中运行时,我可以从浏览器中调用以下方法:

http://localhost:12345/AppServer/MyMethod

Then I installed VS 2012, converted the project, it compiles perfectly but I can't access methods via AppServer route anymore. 然后我安装了VS 2012,转换了项目,可以完美地编译,但是我无法再通过AppServer路由访问方法。 It just says "The resource cannot be found.". 它只是说“找不到资源”。

I checked the service, the line which adds the route is still called. 我检查了服务,添加路由的行仍然被调用。

Any ideas what could be the reason? 任何想法可能是什么原因?

在配置中找到一个pb,关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM