我最近试图升级一个.net 2.0项目,它的DAL由SubSonic 2.2生成到Visual Studio 2010下的.NET 4.0。System.Security.VerificationException:操作可能会破坏运行时。 (Subsonic 2.2)
转换没有错误,但现在我得到一个相当邪恶的项目错误信息,当我尝试启动它。
System.Security.VerificationException: Operation could destabilize the runtime.
at SubSonic.DataProvider.ApplyConfig(NameValueCollection config, Boolean& parameterValue, String configName) in C:\Documents and Settings\Desktop\4.0 Production\rel_1.0\server\Server.DAL\Server.DAL.SubSonic\DataProviders\DataProvider.cs:line 955
at SubSonic.DataProvider.Initialize(String name, NameValueCollection config) in C:\Documents and Settings\Desktop\4.0 Production\rel_1.0\server\Server.DAL\Server.DAL.SubSonic\DataProviders\DataProvider.cs:line 916
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
它抛出异常的代码:
ApplyConfig(config, ref extractClassNameFromSPName, ConfigurationPropertyName.EXTRACT_CLASS_NAME_FROM_SP_NAME);
private static void ApplyConfig(System.Collections.Specialized.NameValueCollection config, ref bool parameterValue, string configName)
{
if(config[configName] != null)
{
parameterValue = Convert.ToBoolean(config[configName]);
}
}
它执行到这里类似的电话,唯一的区别在于它是严格意义上的字符串,而不是一个布尔它在操纵。
private static void ApplyConfig(System.Collections.Specialized.NameValueCollection config, ref string parameterValue, string configName)
{
if(config[configName] != null)
{
parameterValue = config[configName];
}
}
配置被定义为与System.Collections.Specialized.NameValueCollection 3个键 generateNullableProperties,的connectionStringName,generatedNamespace extractClassNameFromSPName ==假
EDIT1:揭开序幕错误的代码在Global.asax的Application_Start()方法
System.Data.SqlClient.SqlDependency.Start(SystemSetting.Schema.Provider.DefaultConnectionString);
EDIT2:错误泡出异常触发一个targetinvocation错误referening我的web.config
<SubSonicService defaultProvider="appPlan">
<providers>
<clear/>
<add name="appPlan" type="SubSonic.SqlDataProvider, appPlan.Server.DAL.SubSonic" generateNullableProperties="false" connectionStringName="appPlan" generatedNamespace="appPlan.Server.DAL"/>
</providers>
</SubSonicService>
有其他人曾经碰到过这样的问题上运行?我可以升级到SubSonic3.x,但我相信这将是一个更大的承诺。
谢谢。
我已经升级了一些网站,使用SubSonic 2.0.3(w /很多定制)从2.0 - > 3.5 - > 4.0没有任何问题。我没有去掉一些提供者,我从来没有,因为我有他们不支持x64的问题。 – Zachary 2011-03-08 01:43:39
我剥离了Oracle,MySql和SqlLite,认为可能存在冲突,但我遇到了同样的问题。 – 2011-03-08 15:35:10
配置系统使用反射非常严重。当访问该属性时,似乎配置的提供程序的一些代码被Jited。在这一点上,运行时检查生成的代码,并告诉你:不要这种类型是不好的。要找到根本原因,您需要在SubSonic.SqlDataProvider中使用Reflector来查看。 – 2011-03-14 18:48:53