user222427
user222427

Reputation:

'System.Data.SqlClient.SqlConnection' threw an exception Windows 7

a bunch of our new users got brand new windows 7 PC's and i'm not sure why I'm getting the below error when the application starts. We run the app as admin and still get the exception thrown. Thanks! Any help is appreciated! The users are also administrators of their own PC.

The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Users\\OMAIN\AppData\Local\Apps\2.0\7LMDR8E0.X2T\60X0DGVM.VVW\asce..tion_6bf0e6a67bb42923_0001.0000_1a6b34a6368d30ed\Creation.exe' or one of its dependencies. Access is denied.
   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)
   at System.Runtime.Hosting.ManifestRunner.get_EntryAssembly()
   at 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(String categoryName, String categoryHelp)
   at System.Data.SqlClient.SqlPerformanceCounters..ctor()
   at System.Data.SqlClient.SqlPerformanceCounters..cctor()
   --- End of inner exception stack trace ---
   at System.Data.SqlClient.SqlConnectionFactory..cctor()
   --- End of inner exception stack trace ---
   at System.Data.SqlClient.SqlConnection..cctor()

Upvotes: 1

Views: 2336

Answers (2)

robin.lo
robin.lo

Reputation: 91

If the service is accessible from the Browser, check the client side endpoint behavior configuration as:

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

Upvotes: 0

ΩmegaMan
ΩmegaMan

Reputation: 31721

Find the file mentioned in the exception "creation.exe" and run dependency walker on it. It may show a missing assembly or dll which is not on the new machines.

Upvotes: 1

Related Questions