【问题标题】:ASP.NET website on localhost errors本地主机错误上的 ASP.NET 网站
【发布时间】:2014-04-18 03:17:25
【问题描述】:

在本地主机上运行我的 ASP.NET 网站时,我收到以下错误..

Parser Error Message: The file '/MPage.master' does not exist.

Line 1:  <%@ page title="" language="VB" masterpagefile="~/MPage.master" autoeventwireup="false" inherits="Page1, App_Web_rscnlqny" %>

我可以使用以下方法解决此问题:

<%@ page title="" language="VB" masterpagefile="./MPage.master" autoeventwireup="false" inherits="Page1, App_Web_rscnlqny" %>

但是在这样做之后我得到了错误:

Parser Error Message: Could not load the assembly 'App_Web_hipf5z3e'. Make sure that it is compiled before accessing the page.

Line 1:  <%@ master language="VB" inherits="MPage, App_Web_hipf5z3e" %>

我该如何解决这个问题??

【问题讨论】:

    标签: asp.net visual-studio-2010 iis localhost parse-error


    【解决方案1】:

    当您获取预编译的 aspx 页面并像未编译一样对其进行编辑时也会发生这种情况,例如从 Live 服务器复制它并覆盖您的开发/工作版本。

    &lt;%@Page /&gt; 标签内的 aspx 页面的第一行,您可能会看到如下属性:

    inherits="yourPageClass, App_Web_hipf5z3e".
    

    删除 App_Web_XXXX 部分并添加指向您的代码隐藏文件的 CodeFile 属性:

    CodeFile="yourPageFile.aspx.cs"
    

    新答案:

    You can mix C# and VB in the same project...but not the same page.

    编辑 Web.config

    <compilation debug="false">
       <codeSubDirectories>
           <add directoryName="VBCode"/>
           <add directoryName="CSCode"/>
       </codeSubDirectories>
    </compliation>
    

    【讨论】:

    • 现在我得到:解析器错误消息:代码文件的语言与页面的语言不一致。第 1 行:
    • 但是在你的代码文件中你使用的是 c# - CodeFile="MPage.master.cs"
    • 我的是 vb - CodeFile="MPage.master.vb"
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多