我有一個.NET Web應用程序,最初運行於.NET 3.5,但將其升級到.NET 4.5.1。當我嘗試運行應用程序,我得到以下錯誤:從.NET 3.5更改爲4.5.1導致應用程序不運行
Configuration Error
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that
attribute names are case-sensitive.
Source Error:
Line 63: debugging ASP.NET files.
Line 64: -->
Line 65: <compilation defaultLanguage="c#" debug="true" targetFramework="4.5.1" />
Line 66: <!-- CUSTOM ERROR MESSAGES
Line 67: Set customErrors mode="On" or "RemoteOnly" to enable custom error messages, "Off" to disable.
Version Information: Microsoft .NET Framework Version:2.0.50727.8745; ASP.NET Version:2.0.50727.8745
你可以通過在最後一行看到,這個應用程序仍然使用.NET框架verison 2.0.50727.8745。
我問我的同事在從源代碼控制中獲取它並運行它之後打開該解決方案,它使用.NET 4.0。*,但他沒有看到此錯誤。這使我相信我的機器出了問題。我查看了applicationhost.config,我甚至沒有看到我的應用程序列出,更沒有關於它使用的.NET版本的任何內容。爲什麼它會在他的機器上工作而不是我的?我需要實施一個錯誤修復程序,如果我無法運行不會發生的應用程序。
你在Visual Studio中調試應用程序嗎?如果是這樣,它是否設置爲IISExpress發佈?項目屬性 - > Web - >服務器 – Sal
你能詳細說明你如何「升級到.net 4.5.1」嗎? – DaniDev
這不是我,而是另一個在項目屬性中更改.NET Framework版本的開發人員。有一個他希望使用的組件需要使用高於3.5的版本。我們應該在接下來的幾個月內將所有的應用程序改爲使用.NET 4.7。 – DesertFoxAZ