开发者

Accessing OData service gives 404 "Resource not found error"

开发者 https://www.devze.com 2023-01-17 11:07 出处:网络
This could be a entirely hosting service related problem but I\'ll post it here in case it is a more common problem.

This could be a entirely hosting service related problem but I'll post it here in case it is a more common problem.

I'm running a OData service on my ASP.NET MVC 2 site which w开发者_StackOverflow社区orks fine on my laptop IIS but when I deploy it to my site at Winhost I get 404 Resource not found error when trying to access the .svc-file.

Earlier I had 2 different authentications on so I got the "System.InvalidOperationException: IIS specified authentication schemes 'Basic, Anonymous'...." error so I know that at that point the handler was trying to start the service.

After fixing that, I got the "Resource not found error".

The service is in /Services folder but it does not seem to matter. No matter where I put it it always gives me the 404 error. All the binaries from my local sites bin folder are in my remote sites bin folder.

Everything else on the site seems to be working fine.

If anyone has a solution to this, help would be much appreciated.


Finally got this figured out. Since my site is an ASP.NET MVC 2 site I need to ignore the route to the service. Otherwise ASP.NET will start looking for a controller for that URI.

So I added routes.IgnoreRoute("Services/ServiceFilename.svc/{*pathInfo}"); to my global.asax.cs and voilá problem solved.

Although I don't quite understand why the service works on my laptops IIS 7 without the ignored route.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号