3

We have a public website that is already exposed to the outside, although in reality there's really nothing there. Simply default.htm file with "Coming Soon" text in it. (http://vensuresoftware.com/)

We also have a WebAPI we've put together that we want to add to this website. When I publish locally to my IIS6, it works no problem. It's accessed as http://localhost/HRConnect/api/Claims just fine. I've used PostMan, a C# client, and Javascript AJAX to access this just fine. I can also load it in a browser at that URL, and I get the appropriate default controller and action.

However, I have been totally unable to accomplish this same thing on the website. Ideally I'd like to include it as a Virtual Directory to the http://vensuresoftware.com and access it as http://vensuresoftware.com/HRConnect/api/Claims but I've had zero luck doing so.

I have tried to add it as a Virtual Directory as well as an Application under that specific website, but when I access the URL, all I get is "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable."

I've ensure the Application pool is correct, with an appropriate user and the pass through connection test succeeds. But I just cannot access the service or the URL.

Any ideas or suggestions at all on what I can try? I'm not sure what else I can include here. Nothing special in IIS, nothing special in the service really. There's only 3 actions in it. As I said, it all works beautifully locally, under localhost though.

jebar8
  • 2,113
  • 3
  • 21
  • 31
Wizaerd
  • 235
  • 3
  • 15
  • So I've learned a few things that might help. The local IIS is version 7.5, the production server where attempting to publish this is IIS 7.0. I read online adding the runAllManagedModulesForAllRequests="true" tag in the config file will solve my issue, but alas all it did was create other errors. For example, seeing as I've developed this with vs2015, the target framework is 4.5.2, which apparently the IIS7.0 does not support. I tried changing my project down to 4.0, but all my NuGet modules started failing. All and all, I'm still unsure how to publish the API. – Wizaerd Jan 14 '16 at 23:03
  • 1
    I'm not clear from your question what you're using to try and deploy the web site. Are you using the Visual Studio 'Publish Web' wizard, or something else? – David Gardiner Jan 15 '16 at 05:22
  • 1
    It doesn't really matter what method I use, the results are the same. If I "publish" via VS locally, it works. If I "publish" via VS remotely, it doesn;t work. If I XCOPY locally, it works, it I xcopy remotely, it doesn;t work. It all boils down to the difference in IIS versions, between version 7 and 7.5. I've gotten it to work, but I have to dratically modify my web.config between the two systems to make it work. – Wizaerd Jan 15 '16 at 15:49

1 Answers1

1

IIS 7 doesn't have built-in support for extensionless URLs which causes a lot of headaches trying to get MVC and Web API apps to run. I've gotten it to work using both these options. Pick the one that applies to you.

  1. Install this IIS patch which allows IIS 7 to handle extensionless URLs.

  2. If the patch isn't an option because you're worried about breaking other sites on the server, you can make the Web.config adjustment found in this answer. You'll have to do this for every MVC/Web API app you have running on the server.

Community
  • 1
  • 1
jebar8
  • 2,113
  • 3
  • 21
  • 31
  • 1
    This is what I've done, as well as comment out the httpRuntime and compilation tags from the web.config as well. These allowed my site to work. I'm curious though what the ramifications of commenting those tags out are... – Wizaerd Jan 16 '16 at 15:04