Jason L
Jason L

Reputation: 85

C# MVC embedded resource works in Casini but not in IIS

I am trying to run a web .NET MVC project from IIS locally, moving away from using Casini so I can change code without having to constantly stop and restart Casini through Visual Studio.

I've gotten everything working in IIS and set up like it is on my server. However, there is a javascript file set up as an embedded resource in a referenced library that is working fine in Casini, but is returning a 404 not found exception in IIS.

This code is not new - it is currently code that is working fine in production. The script is included as part of a script bundle in my BundleConfig.cs file under App_Start. The script file is also being found just fine when run vai Casini. So I don't believe it's a code-related issue. I just think there is something in my IIS configuration that I am missing.

Has anyone else run into this issue, and perhaps has a suggestion for a fix? I would really like to get this working.

Thanks,

Upvotes: 0

Views: 312

Answers (1)

Jason Shepard
Jason Shepard

Reputation: 26

Make sure you have a Handle Mapping setup for your ScriptResource.axd file. The ScriptResource.axd file is responsible for loading javascript or css resources embedded in the project.

In IIS7, you'll need to setup a Managed Handler for the System.Web.Handlers.ScriptResourceHandler Type, and limit your Request path to ScriptResource.axd. The default naming convention is ScriptResourceIntegrated-4.0. Under Request Restrictions, limit the verbs to GET and HEAD, and set your Access Restrictions to Script level.

Upvotes: 1

Related Questions