近日正在練習用MVC做一個連結資料庫可供查詢的網站,記錄一些要注意的地方
- IIS 預設為.NET FrameWork 2.0,必須將其改為.Net FrameWork v4.0.30319。
在命令提示字元輸入:
x86 : %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –i
x64 : %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe –i
- 連結SQL資料庫要設定以下Config for Win7。
Edit the applicationHost.config file found in %windir%\system32\inetsrv\config\
<applicationPools>
<add name="DefaultAppPool" />
<add name="Classic .NET AppPool" managedPipelineMode="Classic" />
<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0" />
<add name="ASP.NET v4.0 Classic" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" />
<applicationPoolDefaults>
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="false" />
</applicationPoolDefaults>
</applicationPools>
After (modified elements in bold):
<applicationPools>
<add name="DefaultAppPool" />
<add name="Classic .NET AppPool" managedPipelineMode="Classic" />
<add name="ASP.NET v4.0" managedRuntimeVersion="v4.0">
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="true" />
</add>
<add name="ASP.NET v4.0 Classic" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" />
<applicationPoolDefaults>
<processModel identityType="ApplicationPoolIdentity" loadUserProfile="true" setProfileEnvironment="false" />
</applicationPoolDefaults>
</applicationPools>