2012-05-08 22 views
2

我有我正在開發三個獨立的網站,都有着一些類,母版頁,等等(呼叫的站點mysite1mysite2,並mysite3如何設置一個使用.NET Web應用程序的子文件夾作爲其基礎的IIS網站?

一個.NET Web應用程序當我瀏覽使用該網站「在瀏覽器中查看「從VS(導致到http://localhost/projectName/mysite1/default.aspx),一切都按預期工作。

但是,我還設置了一個名爲Mysite1的IIS網站,該網站使用http://mysite1/並指向「mysite1」子文件夾作爲其本地路徑(在主目錄下)。當我訪問http://mysite1/,我得到以下ASP.NET錯誤:

Parser Error Message: Could not load type 'MyProject.Mysite1.Default'.

Source Error:

Line 1: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MyProject.Mysite1.Default" %>

Line 2:

Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

的命名空間都是有效的,通過該網站,從「在瀏覽器中查看」運行時正常工作證明。我認爲它與應用程序的基本文件夾有些關係是人爲改變的,因爲這是其他幾個錯誤造成的,但我不知道如何解決它。

我應該如何配置IIS以使用Web應用程序的子文件夾作爲其基礎文件夾?

+0

看看BlogEngine;它使用這個確切的設置。 – IrishChieftain

回答

3
  1. Go to the IIS.
  2. Right Click your WebSite.
  3. Create the Virtual Directory with the name of mysite1.
  4. Right click the Virtual Directory mysite1 and select Convert to Application

現在你可以操作http://mysite1/和內頁mysite1

CodeBehind = Needs to be compiled (asp.net 1.1 model) and compiled binary is placed in the bin folder of the website. You need to do a compile in visual studio before you deploy. Good model when you do not want the source code to be viewable as plain text ... for example when delivering to a customer who you not have obligation to provide code.

CodeFile = You provide the source file with the solution for deployment. ASP.NET 2.0 runtime compiles the code when needed. The compiled files are at Microsfot.NET[.NET version]\Temporary ASP.NET Files.

+0

我沒有「轉換爲Web應用程序」選項(可能是因爲我使用IIS6?),但我通過「虛擬目錄」屬性的「應用程序設置」部分將它創建爲應用程序。 *然而,當我導航到http:// mysite1 /時,我得到相同的錯誤,當我進入http:// mysite1/mysite1 /時,我得到一個身份驗證失敗消息(即使在IIS中設置了身份驗證設置後虛擬目錄)。 –

+0

對您有幫助http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1d1c9a73-b4c5-4cfb-ad69-b77fa2e17e19.mspx?mfr=true – Nilish

+0

這解釋瞭如何轉換爲應用程序,我做了。但我仍然收到相同的錯誤信息。 –

相關問題