A personal repository of technical notes. - CSC

Server-Side Include "Failed to map the path"

Problem
In a VS2005 web site solution, the following server-side include:
<!-- #include virtual="/MyIncludeFile.inc" -->

throws the following error:
Failed to map the path '/MyIncludeFile.inc'.

Web site must be set up in solution as a "Local IIS" or with a Location of "HTTP" rather than "File System".

See quote from "Using IIS with VS 2005 and the new Web Project system - ScottGu's Blog":
The file-system tab option is great if you are working on a self-contained web project that requires no knowledge of the directory or URL structure of content outside its structure.

However, if you are using multiple nested IIS applications or special IIS virtual directory rules on your web server to coordinate multiple applications, then you should avoid opening up these projects using the file-system web option – and instead open them using the “Local IIS” or “Remote Site” tab options. The reason for this is because these nesting and relationship rules are stored in the IIS metabase, and for your application to properly run you will want/need these IIS bindings and semantics to be handled both at runtime and inside VS 2005.

Solution
See How to Convert "File System" web site to "HTTP" web site in VS2005
http://csc-technicalnotes.blogspot.com/2009/02/how-to-convert-file-system-web-site-to.html

References
Local IIS Web Sites
http://msdn.microsoft.com/en-us/library/ckk1e6z4(VS.80).aspx

Server-Side Include Directive Syntax
http://msdn.microsoft.com/en-us/library/3207d0e3(VS.80).aspx

Using IIS with VS 2005 and the new Web Project system - ScottGu's Blog
http://weblogs.asp.net/scottgu/archive/2005/08/23/423409.aspx

No comments:

Post a Comment