问题
I am having a problem while publishing my website on the IIS server, i don't have direct access to it so i have to rely on some one else to configure my website on the IIS. however when i upload my website this error comes up:
Line 1:
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" %>
Line 2:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
Parser Error Message: The file '/server/website/MasterPage.master' does not exist.
my masterpage is in the root folder of the website and default.aspx
is on the root also, i have searched on internet for answer but the best i have found is changing MasterPageFile="~/MasterPage.master"
to MasterPageFile="./MasterPage.master"
but haven't tried yet till Monday.
i would appreciate your help.
回答1:
(i)Make sure that the user account that the server is running under has permissions to access that directory.
(ii)When using "~" in a file path, make sure that the current application deployment believes the root directory is the same as it was before.
(iii)Open IIS, right-click on the virtual directory folder for this site, and selected "Convert to Application." Refresh and check again.
回答2:
I just had this problem and got it fixed. How? I moved all the files up to the root directory of my website. Formerly, I put them in a folder inside another folder in the root folder. I am still wondering why I did that :D Anyways it is all fixed now and running without showing any annoying 'Parser Error' and it is perfectly reading and updating the database accurately.
来源:https://stackoverflow.com/questions/15995520/asp-net-masterpage-master-does-not-exist