1

I am integrating old non-MVC code into an MVC 4 project. The old code had WCF services with .SVC extensions in the root and in the API subfolder that's subject to basic authentication.

At first, posts such as (http://mysite/myservice.svc/DoCommand) to all SVC files were giving 404 errors. Then I added this:

routes.IgnoreRoute("{allsvc}", new { allsvc = @"..svc(/.*)?" });

and the SVC files in the root of the site are now callable. But, the SVC files in the API sub-folder are now returning this:

<Error>
    <Message>
     No HTTP resource was found that matches the request URI 'http://mysite/API/myservice.svc/DoCommand'.
    </Message>
</Error>

If I don't include the DoCommand, then I get the standard WCF info screen.

Oh, and lastly, this only happens in prod -- in development, going against localhost, all works fine.

Your help is greatly appreciated. Thanks.

tereško
  • 58,060
  • 25
  • 98
  • 150
user1044169
  • 2,686
  • 6
  • 35
  • 64

2 Answers2

2

The answer is here Service Stack on MVC4

The issue is that my sub-folder is called Api, which conflicts with the Api naming that comes with WebApi infrastructure that's installed with MVC.

Community
  • 1
  • 1
user1044169
  • 2,686
  • 6
  • 35
  • 64
0

Have you tried setting relaxedUrlToFileSystemMapping="true" in your web.config as detailed by Phil Haack. See this related question: ApiController returns 404 when ID contains period

Community
  • 1
  • 1
Mightymuke
  • 5,094
  • 2
  • 31
  • 42
  • Didn't work. http://mysite/myservice.svc/DoCommand works; http://mysite/API/myservice.svc/DoCommand doesn't work, so it's some kind of routing issue. – user1044169 Nov 19 '12 at 22:20
  • And, that's where it gets confusing. In RouteConfig.cs I have routes.IgnoreRoute("{*allsvc}", new { allsvc = @".*\.svc(/.*)?" });, so I suppose MVC ignores all requests to SVC files. So, what piece of configuration outside of MVC routes to SVC files? I am not sure where to find that. – user1044169 Nov 19 '12 at 22:39