amcdnl
amcdnl

Reputation: 8648

IIS Missing MIME cshtml

When I run my application locally ( VS2013 installed ) everything works fine, but when I deploy the files to another server with only basic IIS installed I get missing CSHTML missing.

Error details:

 HTTP Error 404.3 - Not Found
 The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

 Module
 StaticFileModule 

 Notification
 ExecuteRequestHandler 

 Handler
 StaticFile 

 Error Code
 0x80070032 

 Requested URL
 http://localhost:80/myapp/Default.cshtml 

 Physical Path
 C:\inetpub\wwwroot\myapp\Default.cshtml 

 Logon Method
 Anonymous 

 Logon User
 Anonymous 

...if I add the MIME type it literally just renders some text of my razor view.

I feel like I'm missing some root dependency in my nuget packages that are deployed that is installed by vs out of the box.

My project references look like: http://www.screencast.com/t/BKoB4MSWX and http://www.screencast.com/t/NOOMxD3sYn ... anyone know what im missing?

Updates: No MVC components are installed, I'm not using any MVC just this one page is cshtml. I also don't have any razor dependencies installed at the moment. My app is targeted at .net 4.5.1 . I'm using IIS 7.5. App pool is integrated 4.0 on Windows Server 2008 R2

Upvotes: 1

Views: 7651

Answers (3)

namira
namira

Reputation: 1

Check if ‘CSHTML’ is mapped in IIS Manager. From IIS Manager, select the site you want to add the MIME to from the Connections left pane, In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. mimeMap fileExtension=".cshtml" mimeType="application/x-cshtml" Alternatively, you could use the conf file applicationHost.conf C:\Windows\System32\inetsrv\Config: • And running from command: aspnet_regiis –iru • C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -iru

Upvotes: 0

Yishai Galatzer
Yishai Galatzer

Reputation: 8862

Your problem is probably that you have Razor dependencies in your GAC, but when you deploy they are not there on the remote server.

Install the Web Pages package: Install-Package Microsoft.AspNet.WebPages

You might be missing more things, but that's the minimal starting point

Upvotes: 1

Patrick Geyer
Patrick Geyer

Reputation: 1535

IIS returns 404 for ASP.NET MVC3 file (.cshtml)

Enable runAllManagedModulesForAllRequests:

<modules runAllManagedModulesForAllRequests="true" />

Is this what you're looking for?

Upvotes: 0

Related Questions