2
votes

I've googled and searched stackoverflow, the following were not helpful

RESTFul service works in IIS Express / VS2013 but not on IIS Server - the hot fix when run says "The update is not applicable to your computer."

Different result in IIS express and IIS - not running dotnetnuke or webmatrix

running Win7Pro, with IIS7.5 Have VS2013Pro udpate 3 installed, had VS14CTP installed but is now uninstalled.

Create a new project, chose Web Application, MVC+WebApi, have WebApi 2.2 installed via nuget. Make no changes to app, hit F5, app starts in chrome, see default ASP.NET site with a link to home and api. Clicking the Api link takes you to a help page describing the api calls available.

Publish site to file system, create new IIS website, point site to published folder, add defaultAppPool user to folder. browse to site from within IIS Manager. Site displayes but no styles are displayed. Setup site as machinename:80 also tried machinename:50102. Not using SSL or any authentication.

In chrome console there are 3 errors (this does not happen in IISExpress) Uncaught SyntaxError: Unexpected token < modernizr:1 Uncaught SyntaxError: Unexpected token < jquery:1 Uncaught SyntaxError: Unexpected token < bootstrap:1

Trying to navigate to the api link, just refreshes the page, the help page is not displayed.

Using fiddler to try to hit one of the services in IIS Express works as expected. Using fiddler to try to hit any of the servcies returns the default home page.

Please recall no changes made to code, just the default mvc+webapi solution created.

Checked application_start(), it contains GlobalConfiguration.Configure(WebApiConfig.Register); as the second line.

Any help would be appreciated.

1
Try to access a .css-file or .js-file to see what is returned. Looks like something messes up your files. Judging from the console output and the fact that no styles are loaded. Some missing MIME-types?Håkan Fahlstedt
when I click the "modernizr" in the console error, it returns the default page. Seems like everything returns the default page. Could be a routing issue, but it works under IISExpress, so I have no clue what could be wrong. IIS logs, just show a 200 OK for "/" requests, no 404 or other errors in log.t.durden
Is there a different .NET version on the IIS?Håkan Fahlstedt
@HåkanFahlstedt, interesting though not sure how I'd check that. The app pool is v4.0.30319, integrated. It's the same machine. When you hit F5 to run the web app, it uses IIS Express. However, for trying things out I'd like the app to be running without having to have VS running, so I publish to IIS on the same machine.t.durden
The solution's target framework is set to .NET 4.5. Not 4.5.1 or 4.5.3, both of which appear in the drop-down for target framework.t.durden

1 Answers

0
votes

It basically comes down to how you created the solution. In visual studio 2013 Professional, File->New Project -> Visual C# -> Web -> ASP.NET Web Application Click OK. In the pop up under "Add folders and core refrences for:" MVC is checked and greyed out, you cannot un-select it. Check "Web API" check box, click ok. All will work fine while working in VS. However once published as release. Point IIS at published folder, if needed, navigate to page. Page loads but has errors as described above.

To avoid this, do not check the "Web API" check box when creating the new project. Add Web API to the solution after creating it, not during the creation.

VS version 12.0.31101.0 Update 4 .NET version 4.5.52747