简体   繁体   English

如何在 IIS 7 上部署 MVC 应用程序?

[英]How to deploy an MVC application on IIS 7?

I have a MVC application and I can't get it working on IIS 7. Debugging in VS2010 works fine, but when I publish the website to my local IIS7, I see nothing but blank pages.我有一个 MVC 应用程序,但无法在 IIS 7 上运行。在 VS2010 中调试工作正常,但是当我将网站发布到本地 IIS7 时,我只看到空白页。

Here is what I have done:这是我所做的:

On the project, right click and click Publish.在项目上,右键单击并单击发布。 In the Publish Web window I set these settings:在发布 Web window 我设置这些设置:

  • Publish method: Web deploy发布方式:Web 部署
  • Service URL: localhost服务 URL:本地主机
  • Site/application: Default Web Sit\Africa站点/应用程序:默认 Web Sit\Africa
  • both, Mark as IIS application on destination and Leave extra files on destination (do not delete are checked.两者, Mark as IIS application on destination Leave extra files on destination (do not delete已选中。

In IIS, my application runs under a application pool with supports .net 4.0 and managed pipeline is set to integrated.在 IIS 中,我的应用程序在支持 .net 4.0 的应用程序池下运行,并且托管管道设置为集成。

I don't get any error while publishing, but when I navigate to my site I only see blank pages.发布时我没有收到任何错误,但是当我导航到我的网站时,我只看到空白页。 Nothing happens.什么都没发生。

What goes wrong?出了什么问题?

EDIT:编辑:

When I navigate to http://localhost/Africa/ I see a blank page.当我导航到http://localhost/Africa/时,我看到一个空白页。 When I navigate to http://localhost/Africa/Views/Home/ I get a 500 error.当我导航到http://localhost/Africa/Views/Home/时,我收到 500 错误。

How can I solve this?我该如何解决这个问题?

I ran in to the same exact problem, it took quite a bit of digging to solve.我遇到了同样的问题,需要大量的挖掘才能解决。

I finally found the solution to it on this page: Getting an ASP.MVC2/VS2010 application to work in IIS 7.5我终于在这个页面上找到了解决方案: Getting an ASP.MVC2/VS2010 application to work in IIS 7.5

Yeah, I know that this is an old thread but for the sake of saving someone else's time I'm adding this.是的,我知道这是一个旧线程,但为了节省别人的时间,我添加了这个。 Also make sure you have HTTP Errors, HTTP Redirection, and Static Content enabled in IIS.还要确保 HTTP 错误、HTTP 重定向和 Static 内容在 Z5DA5ACF461B4EFB217E776 中启用。

In your application pool advanced settings, make sure you have Enable 32-bit applications set to true.在您的应用程序池高级设置中,确保您已将启用 32 位应用程序设置为 true。

Some other things to try:其他一些可以尝试的事情:

Change the application pool to classic.将应用程序池更改为经典。

Make sure you have the correct version of MVC installed on your server.确保您的服务器上安装了正确版本的 MVC。

If you are getting 500 errors, you can turn on Failed Request Tracing and check the logs.如果您收到 500 个错误,您可以打开 Failed Request Tracing 并检查日志。 If you are getting 500 errors and no logs are being created, you need to check your web.config.如果您收到 500 个错误并且没有创建日志,则需要检查您的 web.config。

Blank page normally doesn't necessary mean it's not working, if you default page doesn't have anything, it will be blank.空白页面通常并不意味着它不起作用,如果您的默认页面没有任何内容,它将是空白的。

If you run into some error, you normally will see an error page.如果您遇到一些错误,您通常会看到一个错误页面。

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

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