我使用VS2010开发了一个MVC3网站,效果很好。我最近将我的开发环境升级到VS2012 RTM。我现在无法在调试器中运行网站而不会崩溃开发Web服务器。
WebDev.WebServer40.exe已停止工作
我在VS2012中看到两个类似的堆栈跟踪之一:
首先,AccessViolationException
:
mscorlib.dll!System.StringComparer.GetHashCode(object obj) + 0xc bytes
mscorlib.dll!System.Collections.Hashtable.GetHash(object key) + 0x10 bytes
mscorlib.dll!System.Collections.Hashtable.InitHash(object key, int hashsize, out uint seed, out uint incr) + 0xf bytes
mscorlib.dll!System.Collections.Hashtable.Remove(object key) + 0x38 bytes
System.dll!System.Collections.Specialized.NameObjectCollectionBase.BaseRemove(string name) + 0x2e bytes
System.Web.dll!System.Web.SessionState.SessionStateItemCollection.Remove(string name) + 0x56 bytes
System.Web.dll!System.Web.SessionState.HttpSessionStateContainer.Remove(string name) + 0xc bytes
System.Web.dll!System.Web.HttpSessionStateWrapper.Remove(string name) + 0xf bytes
Dive7.Site.dll!Dive7.Site.D7WebViewPage<object>.IsAdmin.get() Line 56 + 0x19 bytes C#
其次,NullReferenceException
:
mscorlib.dll!System.StringComparer.GetHashCode(object obj) + 0x33 bytes
mscorlib.dll!System.Collections.Hashtable.GetHash(object key) + 0x10 bytes
mscorlib.dll!System.Collections.Hashtable.InitHash(object key, int hashsize, out uint seed, out uint incr) + 0xf bytes
mscorlib.dll!System.Collections.Hashtable.Remove(object key) + 0x38 bytes
System.dll!System.Collections.Specialized.NameObjectCollectionBase.BaseRemove(string name) + 0x2e bytes
System.Web.dll!System.Web.SessionState.SessionStateItemCollection.Remove(string name) + 0x56 bytes
System.Web.dll!System.Web.SessionState.HttpSessionStateContainer.Remove(string name) + 0xc bytes
System.Web.dll!System.Web.HttpSessionStateWrapper.Remove(string name) + 0xf bytes
Dive7.Site.dll!Dive7.Site.D7WebViewPage<object>.IsAdmin.get() Line 56 + 0x19 bytes C#
发生的确切似乎是随机的。
据我所知,我所做的只是安装VS2012,重新启动,然后在VS的新版本中打开我的VS2010解决方案,观看它说升级成功,然后按 F5
我没有想法。任何人都可以建议可能发生的事情吗?
答案 0 :(得分:2)
请阅读链接http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253815中的“安装ASP.NET MVC 4打破ASP.NET MVC 3 RTM应用程序”一节。 请关注setps“必需的更新”,如果此错误仍然是重新编辑,请告诉我。
答案 1 :(得分:0)
正如Anand所指出的,当您在VS2012中打开它时,您必须对MVC3应用程序进行一些手动更改,因为VS2012的安装也会导致安装MVC4。这些更改允许并行操作:
在Web.config
:
<appSettings>
<add key="webpages:Version" value="1.0.0.0"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
然后编辑MVC项目的.csproj
文件。替换这些行:
<Reference Include="System.Web.WebPages"/>
<Reference Include="System.Web.Helpers" />
(他们可能看起来像这样):
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
使用这些行:
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>
<Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />