瀏覽ASP.NET網頁,得到500.19錯誤:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Error Code 0x80070021
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
依據過去的知識(參考: 91的文章),常是aspnet_regiis未正確註冊所致,試著註冊卻有新發現:
C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
Microsoft (R) ASP.NET RegIIS version 4.0.30319.33440
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation. All rights reserved.
Start installing ASP.NET (4.0.30319.33440).
This option is not supported on this version of the operating system. Administr
ators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win
dows Features On/Off" dialog, the Server Manager management tool, or the dism.e
xe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771.
Finished installing ASP.NET (4.0.30319.33440).
ASP.NET 4.5跟IIS8已不用aspnet_regiis這招了,要透過Feature管理新增才行,但是如第一張圖例所示,我明明已經裝過ASP.NET 4.5呀?
摸索了一陣子才搞懂,我在新增Role時少選了Application Server項目:
Application Role有個Web Server (IIS) Support,記得也要安裝。
加入Web Server (IIS) Support後,Web Server區會多出Application Developer項目,下面有ASP、ASP.NET 3.5、CGI... 等子項可以選擇。如果想啟用SignalR WebSocket傳輸,記得要勾選WebSocket Protocol。