日期:2014-05-17  浏览次数:20609 次

IIS发布问题
在发布一个网站,在服务器上发布asp.net程序碰到了个问题,就是发布后浏览Login时报错,如下
HTML code

Server Application Unavailable 
The web application you are attempting to access on this web server is currently unavailable.  Please hit the "Refresh" button in your web browser to retry your request. 

Administrator Note: An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur. 









为了找原因,做如下简单的测试
前后台代码如下
C# code

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

    void Page_Load()
    {
        lblServerTime.Text = DateTime.Now.ToString();
    }
    
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>First Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    Welcome to ASP.NET 3.5! The current date and time is:
    
    <asp:Label
        id="lblServerTime"
        Runat="server" />
    
    </div>
    </form>
</body>
</html>




但是单独右键打开这个文件时(IE方式)时报错如下
HTML code

无法显示 XML 页。 
无法查看使用 XSL 样式表的 XML 输入。请更正错误然后单击 刷新 按钮,或稍后重试。 


--------------------------------------------

名称以无效字符开头。处理资源 'file:///E:/Users/Administrator/Desktop/FirstPage.aspx' 时出错。第 1 行,位置: 2 

<%@ Page Language="C#" %>
-^
 





或者把后缀改成htm时,显示不出当前时间,只显示“Welcome to ASP.NET 3.5! The current date and time is: ”






------解决方案--------------------
向iis注册asp.net:aspnet_regiis -i

到开始菜单,找到VS-->配置工具选择-->Notification Services 输入命令aspnet_regiis -i回车就行
------解决方案--------------------
探讨
有安装.NET Framework,程序是4.0版本。IIS中也为发布的那个目录设置了4.0

有没有注册asp.net? 需要如何注册? 应该是没有注册过,过会我问问前台技术

------解决方案--------------------
如果是 安装了数据库在安装的IIS参考5楼 如果是没有安装好的话。那可以考虑卸载了从新装下看看。你本地程序发布有问题么