我已经在IIS版本10、Windows 10操作系统中托管了我的web应用程序。我的web应用程序在visual studio上运行得很完美。
当我在IIS中托管我的应用程序并在location "C:\inetpub\wwwroot\WATER\view\User\AddCustomer.aspx“中浏览我的web表单时,我收到错误:
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 '/view/MasterPage/AdminMaster.master.cs' does not exist.
Source Error:
Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="AdminMaster.master.cs" Inherits="AdminMaster" %>
Line 2:
Line 3: <!DOCTYPE html>
Source File: /view/MasterPage/AdminMaster.master Line: 1
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4075.0
母版页文件目录的路径为:"C:\inetpub\wwwroot\WATER\view\MasterPage“
此web表单AddCustomer.aspx中的母版页路径为::
<%@ Page Title="" Language="C#" MasterPageFile="~/view/MasterPage/AdminMaster.master" AutoEventWireup="true" CodeBehind="AddCustomer.aspx.cs" Inherits="DENTAL.view.User.AddCustomer" %>
我尝试将母版页的路径更改为::
<%@ Page Title="" Language="C#" MasterPageFile="~/AdminMaster.master" AutoEventWireup="true" CodeBehind="AddCustomer.aspx.cs" Inherits="DENTAL.view.User.AddCustomer" %>
然后再一次
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/AdminMaster.master" AutoEventWireup="true" CodeBehind="AddCustomer.aspx.cs" Inherits="DENTAL.view.User.AddCustomer" %>
但没有成功。我也不能从其他目录浏览任何网页表单,到处都得到相同的错误。
请看我的应用程序在IIS中的目录结构图像。请帮帮忙。谢谢!
发布于 2020-06-27 11:14:17
当前母版页路径为~/MasterPage/AdminMaster.master,因为~表示根文件夹(Wwwroot),所以应用程序未获取母版页。
母版页位于~/WATER/view/MasterPage/AdminMaster.master。因此,将引用页(addcustomer.aspx)中的母版页引用更新为:
<%@ Page Title="" Language="C#" MasterPageFile="~/WATER/view/MasterPage/AdminMaster.master" AutoEventWireup="true" CodeBehind="AddCustomer.aspx.cs" Inherits="DENTAL.view.User.AddCustomer" %>
https://stackoverflow.com/questions/62605502
复制