標籤

ASP.NET MVC (29) Visual C# (15) JQuery (10) Plugins (8) JQuery Plugins (6) JavaScript (6) MySQL (5) CSS (4) LinQ (4) Mac OS (4) CentOS (3) Design Pattern (3) Entity Framework (3) IIS (3) Python (3) Windows (3) php (3) Docker (2) LAMP (2) SQL Server (2) WCF (2) .NET (1) .NET Core (1) AWS (1) Browser (1) GIS (1) IE (1) Internet Security (1) Linux (1) Platform (1) React (1) SEO (1) Testing (1) VMware (1) Windows 7 (1) cookie (1) curl (1) laravel (1) phpBB (1) session (1) 中古屋 (1) 透天 (1) 閒言閒語 (1) 面試 (1) 鳥松 (1)
顯示具有 IIS 標籤的文章。 顯示所有文章
顯示具有 IIS 標籤的文章。 顯示所有文章

2013年5月15日 星期三

[ASP.NET MVC][IIS]在應用程式層級之外使用註冊為 allowDefinition='MachineToApplication' 的區段發生錯誤。錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為應用程式


針對網站做發行時發生下列錯誤訊息導致無法發行:

在應用程式層級之外使用註冊為 allowDefinition='MachineToApplication' 的區段發生錯誤。錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為應用程式

網路上找了一下,大致原因是存在了重複的WebConfig檔案,下意識把整個obj目錄砍了再發行一次就沒問題了,詳細原因沒研究。


保哥部落格有相關資訊:

ASP.NET MVC 建置部署套件後無法 MvcBuildViews 的解法

Reference:

Asp.net MVC 建置發行時出現錯誤訊息:錯誤的原因可能是虛擬目錄尚未在 IIS 中設定為應用程式。






















2011年3月15日 星期二

[IIS] 如何在IIS Express 使用多個網站

關鍵字:IIS Express 啟動 啟用 開啟 多個 兩個 網站 網頁 站台
======================
How to host more than two web applications in the same website on IIS Express 7.5?

假設要開兩個網頁應用程式分別在C:\web1、C:\web2中,在applicationhost.config中定義如下:


    <site name="Test" id="2" serverAutoStart="true">
        <application path="/">
            <virtualDirectory path="/" physicalPath="C:\tempweb" />
        </application>
        <application path="/a">
            <virtualDirectory path="/" physicalPath="C:\web1" />
        </application>
        <application path="/b">
            <virtualDirectory path="/" physicalPath=" C:\web2" />
        </application>

        <bindings>
            <binding protocol="http" bindingInformation=":80:192.168.2.100" />
        </bindings>
   </site>

然後就可以使用 http://192.168.2.100/a , http://192.168.2.100/b 來訪問網頁了。

2011年3月6日 星期日

[IIS 7.5 Express]如何使用Windows Service啟動IIS Express 並且開port 80外網

[How to use windows service to start IIS Express 7.5 and serve external on port 80]

研究了三天,終於發現就算使用Administraotor權限,建立Process時也是拒絕存取的狀況,不過如果你使用我下面的方法,就可以順利使用Windows Service方式啟動IIS Express 7.5,並且可以提供外網服務在port 80上。

1. 呼叫iisexpress.exe必須傳入【/site:你的網站名稱】
2. 如果是Windows XP中,Windows Service帳戶預設讀取IIS Express的設定檔為【C:\Documents and Settings\LocalService\My Documents\IISExpress\config】
3. 設定檔中必須定義以下東西:


            <site name="TestMVC" id="2" serverAutoStart="true">
                <application path="/">
                    <virtualDirectory path="/" physicalPath="C:\TestMVC" />
                </application>
                <bindings>
                    <binding protocol="http" bindingInformation="*:80:192.168.10.128" />
                </bindings>
            </site>
          <!-- (其中site name就是網站名稱,bindingInformation就是你要開的IP與Port) -->


4. Windows Service必須要這樣寫(我使用Visual C# 2010):

                            Directory.SetCurrentDirectory(string.Format(@"C:\Program Files\IIS Express"));
                            process.StartInfo.WorkingDirectory = @"C:\Program Files\IIS Express";
                            process.StartInfo.FileName = @"C:\Program Files\IIS Express\iisexpress.exe";
                        process.StartInfo.Arguments = String.Format("/site:{0}", WebSiteName);
                        process.StartInfo.UseShellExecute =  false;
                        process.StartInfo.CreateNoWindow = true;
                        process.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
                       process.StartInfo.Verb = "runas"; //********VeryImportant!!
                        System.Diagnostics.Process.Start(process.StartInfo);


=======================
如果有任何問題歡迎留言發問。
If you have any problem , let me know~
=======================

更新:
1. 如果在Win7上,可能需要執行下列命令:
>netsh http add urlacl url=http://yourIP:yourPort/ user=everyone
例如 >netsh http add urlacl url=http://192.168.0.1:8080/ user=everyone

2. 需打開Windows防火牆,允許TCP連入連出,埠號為8080(看您設定的是哪個埠號)。