MVC4.0网站发布和部署到IIS7.0上的方法

news/2024/5/8 15:32:59/文章来源:https://blog.csdn.net/weixin_34293246/article/details/94023622

最近在研究MVC4,使用vs2010,开发的站点在发布和部署到iis7上的过程中遇到了很多问题,现在将解决的过程记录下来,以便日后参考,整个过程主要以截图形式呈现

vs2010的安装和mvc4的安装不在本次记录之列,主要记录网站发布和iis的部署

使用的版本如下图所示:

iis为7.0:

vs2010,.net framework 为4.0.30310 ,安装mvc4需要升级vs2010到vs2010 sp1 版本,见图示:

 

mvc4:

 

为了测试需要,在项目ZPG.SpecialSite中创建控制器HomeController,并创建视图Index.cshtml,如下图:

编辑视图页面,添加测试用文字,如图所示:

接下来对刚刚创建的mvc4.0站点进行发布,步骤如下:

1.右击需要发布的项目,在弹出的菜单中选择“发布...”选项

2.在“发布web”对话框中进行设置,配置文件名称默认为“配置文件1”可以修改为需要的名字,以便识别,也可以不改。发布方法选择“文件系统”,目标位置处选一个文件夹用于存放将要发布的整个站点所有文件,这里我选择为“D:/我的文档/桌面/ZPGWeb”,然后点击“发布”按钮。如图:

3.点击发布后在指定的文件夹生成站点文件,发布成功!

接下来将发布成功的站点部署到iis7.0。

步骤如下:

1. 安装 Microsoft .net FrameWork 4.0安装包(网站开发时候使用的就是.net framework4.0框架);

2. 安装ASP.NET MVC 4.0 ;

3. 设置IIS的“ISAPI和CGI限制”中的“ASP.NET v4.0.0.30319”为允许,如下图所示:

4.在iis7.0中发布网站,如图,设置网站主目录为“D:/我的文档/桌面/ZPGWeb”:

5.设置该网站(站点“SpecialSite”)应用程序池的.net framework 版本为4.0.30196 :

添加应用程序池:

将该添加的应用程序池设置给站点SpecialSite

6.至此完成了mvc4.0站点在iis7.0的部署。

接下来在浏览器输入http://localhost查看刚才部署的mvc4.0项目,如下图:

如果出现上图内容,表明iis7.0成功运行由mvc4.0创建的项目!!

后续注意点:

1.如果读者使用的iis是在安装完.net framework 之后才安装的,需要进行iis注册,开始--运行--cmd,打开命令行提示符,输入命令如下

C:/Windows/Microsoft.NET/Framework/v4.0.30319/aspnet_regiis.exe -i

回车运行,如果读者的服务器是64系统,那么需要使用命令C:/Windows/Microsoft.NET/Framework64/v4.0.30319/aspnet_regiis.exe -i 来运行注册iis。

2.由于mvc4.0在创建项目后,默认在项目下的App_Start文件夹中的文件“RouteConfig.cs”里自动配置了“默认路由”为HomeController控制器下的Index方法(ActionResult),所以不需要在站点默认文档里配置默认文档名字,该站点会自动根据mvc的路由机制找到默认需要显示的视图文件。如下图:

 

PS:此篇文章是在网络上看到的,作为学习用

转载于:https://www.cnblogs.com/xoyoho/p/6688355.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_785207.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

抓取某一个网站整站的记录

2019独角兽企业重金招聘Python工程师标准>>> 经常由于某些原因我们需要爬取某一个网站或者直接复制某一个站点,到网上找了很多工具进行测试,试了很多各有各的问题,最终选择了Teleport Ultra,用起来效果很好&#xff1b…

防弹您的Drupal网站

“When you steal money or goods, somebody will notice it’s gone. When you steal information, most of the time no one will notice because the information is still in their possession.” – Kevin Mitnick, The Art of Deception, 2003.“当您窃取金钱或商品时&am…

Magento电子商务网站的SEO指南

Magento is only five years old but is already the most popular open-source eCommerce platform on the net, boasting a community of over 150,000 online retailers. Magento只有5岁,但已经是网络上最受欢迎的开源电子商务平台,拥有超过150,000个…

使用WordPress构建非博客网站

This post digs into how you can use WordPress to run a regular, non-blog website. 这篇文章深入探讨了如何使用WordPress来运行常规的非博客网站。 WordPress began as a blogging platform and has a long-established dominance in the world of blogging. No matter w…

2m带宽允许多少用户访问_您有多少用户需要可访问的网站?

2m带宽允许多少用户访问The Web Content Accessibility Guidelines (WCAG) came into existence in order to provide equal access and equal opportunity to people with disabilities. If the Web is accessible, many people with disabilities can communicate and intera…

谷歌深度神经网络_本周关注我们:轻松阅读,神经网络和Google召集不良网站

谷歌深度神经网络发展更好的体验 (Developing a Better Experience) With the wide variety of devices people use to browse the web today, steps are being taken to try and maintain peoples quality of experience. Google are now calling out pages that will not wor…

modern php_如何使用Modern.IE在本地测试您的网站

modern phpThis article was sponsored by Modern.IE. Thanks for supporting the sponsors that make SitePoint possible! 本文由Modern.IE赞助。 感谢您支持使SitePoint成为可能的赞助商! There’s no shortage of front end tools to help us test the qualit…

web应用程序和web网站_Web应用程序是未来

web应用程序和web网站Native mobile apps are a little weird, if you stop and think about them. 如果您停下来考虑一下,本机移动应用程序会有些奇怪。 The average mobile app weighs around 20MB, often requires an internet connection in order to be used …

joomla一键部署_如何在阿里云ECS上部署和托管Joomla网站

joomla一键部署This article was originally published on Alibaba Cloud. Thank you for supporting the partners who make SitePoint possible. 本文最初发表在阿里云上 。 感谢您支持使SitePoint成为可能的合作伙伴。 Joomla! is a free and open source content manageme…

seo策略_改善参与度指标的5种基本SEO策略

seo策略Every time someone types in a search query on Google, they’re given a list of results. 每当有人在Google上输入搜索查询时,就会得到一个结果列表。 The way in which those results are ordered is a highly complex algorithmic process that take…

wordpress环境安装_为什么暂存环境对于WordPress网站至关重要

wordpress环境安装This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible. 本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。 Have you …

什么是您网站的正确图像格式?

This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible. 本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。 As of March 2017, images m…

seo服务端渲染_我应该向SEO服务收取多少费用?

seo服务端渲染Good SEO might be the very reason you’re reading this article. As its name implies, SEO is the process of optimizing a website or web page to maximize visibility in search engine results, and it is hugely important for any business that maint…

wordpress 邮件_将您的WordPress网站变成电子邮件营销机器

wordpress 邮件With over 35,000 plugins available, there are few things that you cannot do with WordPress. 有超过35,000个可用的插件,几乎没有WordPress无法做的事情。 For many site builders, the ultimate goal is to reach as many viewers as possible…

微信小程序选择图片优化_如何选择完美的图像格式来优化您的网站

微信小程序选择图片优化This article was sponsored by Cloudinary. Thank you for supporting the partners who make SitePoint possible. 本文由Cloudinary赞助。 感谢您支持使SitePoint成为可能的合作伙伴。 When adding images to a website, most of us will instinctiv…

Visual Studio Community 2015:设置网站

This article was sponsored by Microsoft. Thank you for supporting the sponsors who make SitePoint possible. 本文由Microsoft赞助。 感谢您支持使SitePoint成为可能的赞助商。 For this series of articles, we’re going to use Microsoft’s modern IDE: Visual Stud…

wordpress移动_如何轻松地将WordPress网站转换为移动应用程序

wordpress移动Whether you are an advanced or novice WordPress user, for many companies and organizations, having an mobile app for your website can be a huge asset for improving overall reach. Unfortunately mobile development typically is a labor intensive …

八岐大蛇蛇的伤害算谁的伤害_避免诱惑损害网站性能

八岐大蛇蛇的伤害算谁的伤害SitePoint recently published Lean Websites, by Barbara Bermes—a book that presents the latest techniques for improving web page performance. In this article, Barbara details some of the performance pitfalls that all too often cat…

css gpu加速_五个CSS性能工具可加速您的网站

css gpu加速This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible. 本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。 In this article…

php网站开发架构_PHP的干净代码架构和测试驱动开发

php网站开发架构The Clean Code Architecture was introduced by Robert C. Martin on the 8light blog. The idea was to create an architecture which is independent of any external agency. Your business logic should not be coupled to a framework, a database, or t…