ASP.NET网站上的localhost错误

时间:2014-03-13 11:52:26

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

在localhost上运行我的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" %>

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

当您使用预编译的aspx页面并将其编辑为未编译时,例如从Live服务器复制并覆盖您的开发/工作版本时,也会发生这种情况。

<%@Page />标记内的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>
相关问题