'System.Data.SqlClient.SqlConnection' 抛出了一个异常 Window

本文关键字:异常 Window 一个 Data System SqlClient SqlConnection | 更新日期: 2023-09-27 18:37:08

我们的一群新用户获得了全新的Windows 7 PC,我不确定为什么在应用程序启动时出现以下错误。 我们以管理员身份运行应用,但仍会引发异常。 谢谢! 任何帮助不胜感激! 用户也是自己 PC 的管理员。

"System.Data.SqlClient.SqlConnection"的类型初始值设定项引发了异常。System.TypeInitializationException:"System.Data.SqlClient.SqlConnectionFactory"的类型初始值设定项抛出了异常。---> System.TypeInitializationException:"System.Data.SqlClient.SqlPerformanceCounters"的类型初始值设定项抛出了异常。---> System.IO.FileLoadException:无法加载文件或程序集 'file:///C:''Users''''OMAIN''AppData''Local''Apps''2.0''7LMDR8E0。X2T''60X0DGVM.VVW''asce..tion_6bf0e6a67bb42923_0001.0000_1a6b34a6368d30ed''Creation.exe' 或其依赖项之一。访问被拒绝。   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)   at System.Reflection.Assembly.LoadFrom(String assemblyFile)   在 System.Runtime.Hosting.ManifestRunner.get_EntryAssembly() 处   在 System.AppDomainManager.get_EntryAssembly()   at System.Reflection.Assembly.GetEntryAssembly()   at System.Data.ProviderBase.DbConnectionPoolCounters.GetAssemblyName()   at System.Data.ProviderBase.DbConnectionPoolCounters.GetInstanceName()   at System.Data.ProviderBase.DbConnectionPoolCounters..ctor(字符串类别名称, 字符串类别帮助)   at System.Data.SqlClient.SqlPerformanceCounters..ctor()   at System.Data.SqlClient.SqlPerformanceCounters..cctor()   ---内部异常堆栈跟踪结束---   at System.Data.SqlClient.SqlConnectionFactory..cctor()   ---内部异常堆栈跟踪结束---   at System.Data.SqlClient.SqlConnection..cctor()

'System.Data.SqlClient.SqlConnection' 抛出了一个异常 Window

找到异常"creation.exe"中提到的文件,并在其上运行依赖 walker。它可能会显示缺少程序集或 dll,而这些程序集或 dll 不在新计算机上。

如果可从浏览器访问该服务,请检查客户端终结点行为配置,如下所示:

<endpointBehaviors>
    <behavior name="clientEndpoint">
        <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        <clientCredentials>
            <windows allowedImpersonationLevel="Delegation"/>
        </clientCredentials>
    </behavior>
</endpointBehaviors>