首页 新闻 搜索 专区 学院

System.Security.Cryptography.CryptographicException: 拒绝访问

0
[待解决问题]

应用程序D111 采用asp.net mvc +EF6,sqlserver + IIS

1.本地调试和测试环境都没事,发布到正式环境报错System.Security.Cryptography.CryptographicException: 拒绝访问 。
查看日志是 EF访问一个数据库视图时报的,相同的数据库为什么在测试环境和本地调试都没事,正式环境就有问题呢?
2.连同该应用程序同时发布的还有两个程序,都访问的相同的数据库,都部署在相同的IIS下,相同的应用程序池,其他两个程序都正常,唯独D111出错。

 

堆栈错误如下:
2017-12-11 15:30:01,828 [375] ERROR GetReportJson [(null)] (null) - Line:235 mscorlib at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Data.Entity.Core.Common.Internal.Materialization.Translator.TranslateColumnMap(Translator translator, Type elementType, ColumnMap columnMap, MetadataWorkspace workspace, SpanIndex spanIndex, MergeOption mergeOption, Boolean streaming, Boolean valueLayer)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Boolean streaming, Span span, IEnumerable`1 compiledQueryParameters, AliasGenerator aliasGenerator)
at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Intechhosun.Clinic.EF.ExamApp.GetReportImages(String basePath, String regid) in E:*********\Biz\Exam\ExamApp.cs:line 239
at Intechhosun.Clinic.ExamFile.ExamController.GetReportJson() in E:*********\Areas\Clinic\Controllers\ExamController.cs:line 235Exception has been thrown by the target of an invocation.System.Security.Cryptography.CryptographicException: 拒绝访问。

at System.Security.Cryptography.CapiNative.AcquireCsp(String keyContainer, String providerName, ProviderType providerType, CryptAcquireContextFlags flags, Boolean throwPlatformException)
at System.Security.Cryptography.SHA256CryptoServiceProvider..ctor()
at System.Data.Entity.Core.Common.Utils.MetadataHelper.CreateSHA256HashAlgorithm()
at System.Data.Entity.Core.Metadata.Edm.ClrEntityType.BuildEntityTypeHash()
at System.Data.Entity.Core.Metadata.Edm.ClrEntityType.get_HashedDescription()
at System.Data.Entity.Core.Objects.Internal.EntityProxyFactory.TryCreateProxyType(EntityType ospaceEntityType, MetadataWorkspace workspace)
at System.Data.Entity.Core.Objects.Internal.EntityProxyFactory.GetProxyType(ClrEntityType ospaceEntityType, MetadataWorkspace workspace)
at System.Data.Entity.Core.Common.Internal.Materialization.Translator.TranslatorVisitor.Visit(EntityColumnMap columnMap, TranslatorArg arg)
at System.Data.Entity.Core.Query.InternalTrees.EntityColumnMap.Accept[TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor, TArgType arg)
at System.Data.Entity.Core.Common.Internal.Materialization.Translator.TranslatorVisitor.ProcessCollectionColumnMap(CollectionColumnMap columnMap, TranslatorArg arg, ColumnMap discriminatorColumnMap, Object discriminatorValue)
at System.Data.Entity.Core.Common.Internal.Materialization.Translator.TranslatorVisitor.Visit(SimpleCollectionColumnMap columnMap, TranslatorArg arg)
at System.Data.Entity.Core.Query.InternalTrees.SimpleCollectionColumnMap.Accept[TResultType,TArgType](ColumnMapVisitorWithResults`2 visitor, TArgType arg)
at System.Data.Entity.Core.Common.Internal.Materialization.Translator.TranslateColumnMap[T](ColumnMap columnMap, MetadataWorkspace workspace, SpanIndex spanIndex, MergeOption mergeOption, Boolean streaming, Boolean valueLayer)

亮仔的给力人生的主页 亮仔的给力人生 | 菜鸟二级 | 园豆:201
提问于:2017-12-11 15:51
< >
分享
所有回答(1)
0
dudu | 园豆:38908 (高人七级) | 2017-12-11 22:45

没有效果,试了很多网上能搜到的办法。无奈,只要将系统中的这个模块挪走了,放到另外一个应用程序里,好在功能模块很好移植,就正常了。

支持(0) 反对(0) 亮仔的给力人生 | 园豆:201 (菜鸟二级) | 2017-12-12 17:14
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册