【问题标题】:ASP.NET Attempt by method ... to access field 'System.Data.SqlClient.xxx._connection' failedASP.NET 尝试通过方法...访问字段“System.Data.SqlClient.xxx._connection”失败
【发布时间】:2016-05-12 14:03:32
【问题描述】:

我正在使用来自 NuGet 的包,它在本地主机上工作,在生产服务器上工作,但在最近移动到不同的生产服务器后,我收到以下错误:

Attempt by method 'EntityFramework.BulkInsert.Extensions.TypeExtensions.GetPrivateFieldValue(System.Object, System.String)' to access field 'System.Data.SqlClient.SqlConnection._connectionString' failed.

包是:https://efbulkinsert.codeplex.com/ 我不认为它是特定于包的,因为使用替代包进行批量插入我得到了类似的错误:

Attempt by method 'Z.Utility.SqlBulkOperation.SetCommonSetting()' to access field 'System.Data.SqlClient.SqlBulkCopy._connection' failed.

这里常见的是System.Data.SqlClient.xxx._connection failed

我需要查看任何 IIS 设置吗?我被难住了。

【问题讨论】:

  • 也许提供一些你的代码?
  • 真的没什么,使用第一个包db.BulkInsert(records);,使用第二个包db.SqlBulkInsert(records);。该代码有效,只是不在特定服务器上。

标签: c# asp.net-mvc entity-framework c#-4.0 bulkinsert


【解决方案1】:

我不得不在 IIS 中将 .NET 信任级别从“中等”更改为“完全”。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-10-27
    • 1970-01-01
    • 2015-06-20
    • 2011-07-08
    • 1970-01-01
    • 2013-12-13
    • 1970-01-01
    相关资源
    最近更新 更多