码迷,mamicode.com
首页 > Web开发 > 详细

VS网站开发的发布部署的不同情况说明

时间:2018-07-27 15:34:44      阅读:263      评论:0      收藏:0      [点我收藏+]

标签:部署   title   no-repeat   important   inherits   css   org   detail   osi   

VS网站开发有两种模式:

1、网站模式
2、应用模式
其中,网站模式的发布,要考虑勾选“使用固定命名和单页程序集”
 
如下图
 
网站模式:
 
 
应用模式:
 
 
 
两者区别:
1、是否编译:
(1)网页内容变更都不需要编译
(2)网站模式的cs代码变更,不需要编译,刷新即可看到效果
(3)应用网站模式的cs代码变更,需要编译系统,才能看到效果
(个人感觉,网站模式内容修改后刷新网页即可看到效果,开发效率高)
 
2、页面文件:
(1)网站模式:有两个文件:aspx和aspx.cs
(2)应用网站:有三个文件:aspx、aspx.cs和.aspx.designer.cs
 
3、网站发布:
(1)网站模式:2种
A.aspx和aspx.cs都发布上去运行,直接生效模式
B.用vs打包发布模式
 
(2)应用网站:1种方式
编译通过后,cs成为一个统一的dll文件,发布aspx等页面文件和dll上去,cs文件不需要发布。
 
 
4、网站模式的网站发布的特别说明:
如果选择cs文件都发布上去的模式,就无特别说明
如果是vs打包发布模式,注意一个选项:
 
 
 
如上图
如果不勾选“使用固定命名和单页程序集”
发布出来的dll会随机命名,页面的Page inherits 会更新dll的随机名
如下源码:
<%@ page language="C#" autoeventwireup="true" inherits="ErrorPage_UrlError, App_Web_iixanlav" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>403页面</title>
<style type="text/css">
.btnBack{top: 476px;  position: absolute; text-align:center; width:100%;}
</style>

</head>
<body style=" text-align:center; margin:0px;">
<img id="error_img" src="../Images/error/405.png" />
<form id="form1" runat="server">
<div class="btnBack">
<input id="Button1" type="button" style="width:130px; height:50px;background:url(../Images/error/error_back.png) no-repeat; border:none; color:#f00; cursor:pointer;" onclick="javascript:window.location=‘../Login.aspx‘;" />
</div>
   
    <div>
       <asp:Literal ID="ltMessage" runat="server"></asp:Literal>
    </div>
</form>
</body>
</html>

 

   
 
上面的inherits="ErrorPage_UrlError, App_Web_iixanlav"
中的App_Web_iixanlav会根据编译出来的dll不同而不同。
(注:这样发布,bin目录不清空的话,会在bin目录下积累历史的不同版本的dll文件,bin会变得臃肿)
 
如果勾选“使用固定命名和单页程序集”
发布的dll会固定命名,页面的Page inherits 也在两次发布的版本也一致
如下源码:
 
 
<%@ page language="C#" autoeventwireup="true" inherits="ErrorPage_UrlError, App_Web_urlerror.aspx.83c043b9" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>403页面</title>
<style type="text/css">
.btnBack{top: 476px;  position: absolute; text-align:center; width:100%;}
</style>

</head>
<body style=" text-align:center; margin:0px;">
<img id="error_img" src="../Images/error/405.png" />
<form id="form1" runat="server">
<div class="btnBack">
<input id="Button1" type="button" style="width:130px; height:50px;background:url(../Images/error/error_back.png) no-repeat; border:none; color:#f00; cursor:pointer;" onclick="javascript:window.location=‘../Login.aspx‘;" />
</div>
   
    <div>
       <asp:Literal ID="ltMessage" runat="server"></asp:Literal>
    </div>
</form>
</body>
</html>

 

原文链接:

http://www.lookdaima.com/WebForms/WebPages/Blanks/Pm/Docs/DocItemDetail.aspx?id=ea2fd50d-ca48-47d0-a09c-02d3736bc5dd

VS网站开发的发布部署的不同情况说明

标签:部署   title   no-repeat   important   inherits   css   org   detail   osi   

原文地址:https://www.cnblogs.com/slowx/p/9377668.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!