简体   繁体   中英

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

Evening folks!!

Stuck with this rather dull problem. I have deployed my website on my localhost (ie C:\\inetpub\\wwwroot\\MyWebSite) but when i access it in the browser, I get this error message:

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

It's weird coz the Site.Master is right there in the root folder. I have got 2 more folders in my website that have got a web.config each and i have converted these folders to applications from within the IIS. This error occurs when i access pages from these folders as well.

so the urls: http://localhost/mywebsite and http://localhost/mywebsite/mysubfolder , both have the aforementioned problem. And in both cases, the master page file does exist in the corresponding folders. I have checked the path of the MasterPageFile in my Default.aspx page and its "~/Site.Master" and the i can successfully run the web app from within Visual Studio (ie Cassini).

It would be really great if anyone can help me solve this mystery. Let me know if you need more info.

Much appreciated.

您可能需要将mywebsite文件夹设置为IIS中的应用程序。

Turns out, the Default website in IIS was using the same port as the one that i created with a different host header. Stopping the Default website, then creating the website to point to C:\\Inetpub\\wwwroot and then converting the root website folder to an application and all the needed folders under it, fixed this problem. But how do you access ie what would be the URL for, a website that uses the same port but has a different host header defined? this still needs to be understood.

Replace the tilde before ~/MasterPage.master with a period ./MasterPage.master .

<%@ Page Language="C#" MasterPageFile="./MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Untitled Page" %>
Line 2: 

I'm going to add an extra answer to this, in case it helps someone else in the future.

I had the same problem with an added Master page, which for some reason my site was refusing to acknowledge and publish (Blank.Master in my case, a name I've used many times). Although I couldn't find the root cause of this problem, I WAS able to work around the issue by creating a new copy of the master file, naming it something different (Empty.Master), and changing the master page reference on the affected pages.

It's probably not a great solution, really, but I was on a deadline, and it at least allowed me to continue my work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM