asp.net deploy - 找不到Main.Master.cs文件

tes*_*est 5 c# asp.net azure

我目前正在azure上部署我的网站.我的一个页面工作正常,但我有另一个页面使用主页面,没有加载,因为我收到此错误:

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 

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

Source Error: 


Line 1:  <%@ Master Language="C#" AutoEventWireup="true" CodeFile="Main.master.cs" Inherits="ThirdEye.Main" %>
Line 2:  
Line 3:  <%@ Register Src="~/controls/Footer.ascx" TagName="Footer" TagPrefix="ThirdEye" %>

Source File: /Main.master    Line: 1 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
Run Code Online (Sandbox Code Playgroud)

我无法弄清楚我的错误.我已经上传了可执行文件,这些页面都在bin文件夹的同一目录下.你认为我必须在CodeFile属性或Inherits属性前添加句点或代字号吗?

我正在使用.net framework v4.我不能使用3.5,我不认为这应该是问题.

Main.Master

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Main.master.cs" Inherits="Main" %>
Run Code Online (Sandbox Code Playgroud)

Main.Master.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using ThirdEye;

public partial class Main : System.Web.UI.MasterPage
    {....
Run Code Online (Sandbox Code Playgroud)

Eri*_*ric 15

您使用的是Web应用程序项目(而不是Web站点项目)吗?如果是这样,更改CodeFileCodeBehind应解决错误.

Web应用程序部署已编译,并且不包括使用时所需的原始cs文件CodeFile.


Avk*_*han 3

根据上述错误,似乎 MainMaster.master.cs 未部署到 Windows Azure。

当您在项目中添加新的母版页名称“MainMaster.master”时,是否将其属性设置为“复制到输出目录”作为“始终复制”,因为默认情况下未设置它,因此该文件将不会被您的 Windows Azure 包的一部分并导致此类错误。

请您核实一下情况是否如此?