简体   繁体   English

IIS缺少MIME cshtml

[英]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. 当我在本地运行我的应用程序(已安装VS2013)时,一切正常,但是当我将文件部署到仅安装了基本IIS的另一台服务器时,缺少CSHTML。

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. ...如果我添加MIME类型,它实际上只是呈现剃刀视图的某些文本。

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. 我觉得我在nuget包中缺少了一些根依赖性,这些nuget包是由vs开箱即用安装的。

My project references look like: http://www.screencast.com/t/BKoB4MSWX and http://www.screencast.com/t/NOOMxD3sYn ... anyone know what im missing? 我的项目参考如下: http : //www.screencast.com/t/BKoB4MSWXhttp://www.screencast.com/t/NOOMxD3sYn ...有人知道我缺少什么吗?

Updates: No MVC components are installed, I'm not using any MVC just this one page is cshtml. 更新:没有安装MVC组件,仅此一页是cshtml,我没有使用任何MVC。 I also don't have any razor dependencies installed at the moment. 我目前也没有安装任何剃须刀依赖项。 My app is targeted at .net 4.5.1 . 我的应用程序针对.net 4.5.1。 I'm using IIS 7.5. 我正在使用IIS 7.5。 App pool is integrated 4.0 on Windows Server 2008 R2 应用程序池在Windows Server 2008 R2上集成为4.0

Your problem is probably that you have Razor dependencies in your GAC, but when you deploy they are not there on the remote server. 您的问题可能是您的GAC中有Razor依赖项,但是在部署时它们不在远程服务器上。

Install the Web Pages package: Install-Package Microsoft.AspNet.WebPages 安装网页包: Install-Package Microsoft.AspNet.WebPages

You might be missing more things, but that's the minimal starting point 您可能会想念更多的东西,但这是最小的起点

IIS returns 404 for ASP.NET MVC3 file (.cshtml) IIS为ASP.NET MVC3文件(.cshtml)返回404

Enable runAllManagedModulesForAllRequests : 启用runAllManagedModulesForAllRequests

<modules runAllManagedModulesForAllRequests="true" />

Is this what you're looking for? 这是您要找的东西吗?

Check if 'CSHTML' is mapped in IIS Manager. 检查“ CSHTML”是否在IIS管理器中映射。 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. 在IIS管理器中,从“连接”左窗格中选择要将MIME添加到的站点,在“主页”窗格中,双击“ MIME类型”。 In the MIME Types pane, click Add... in the Actions pane. 在“ MIME类型”窗格中,在“操作”窗格中单击“添加...”。 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 mimeMap fileExtension =“。cshtml” mimeType =“ application / x-cshtml”或者,您可以使用conf文件applicationHost.conf C:\\ Windows \\ System32 \\ inetsrv \\ Config:•并从命令运行:aspnet_regiis –iru•C: \\ Windows \\ Microsoft.NET \\ Framework \\ v4.0.30319> aspnet_regiis -iru

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM