title: Run application connect to SQL Server by Windows Guest user account
body: <p>I have a .NET windows application connected to a SQL Server 2008 database, I am deploying this app on clients machines using click-once technique through the web.</p>
  
  <p>Now I am testing the application under different user permissions.</p>
  
  <p>When I test the application on Administrator user and the standard user (limited user in Windows XP). and the app run successfully </p>
  
  <p>When I tested the application on the Guest user account, I got the following .NET SQL Exception:</p>
  
  <pre><code>The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception.
   9/26/2012 11:25:33 AM: Stack:    at System.Data.SqlClient.SqlConnection..ctor()
   at    
    System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Initialize
   (IData 
   Services dataServices, Object connection)
   at System.Data.Linq.DataContext.Init(Object connection, MappingSource mapping)
   at System.Data.Linq.DataContext..ctor(String fileOrServerOrConnection, MappingSource 
   mapping)
  </code></pre>
  
  <p>and here is the inner exception:</p>
  
  <p>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.UnauthorizedAccessException: Access to the path 'Global.net data provider for sqlserver' is denied.
     at System.IO._<em>Error.WinIOError(Int32 errorCode, String maybeFullPath)
     at System.Threading.Mutex.&lt;>c</em>_DisplayClass3.&lt;.ctor>b__0(Object userData)
     at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
     at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean&amp; createdNew, MutexSecurity mutexSecurity)
     at System.Diagnostics.SharedUtils.EnterMutexWithoutGlobal(String mutexName, Mutex&amp; mutex)
     at System.Diagnostics.SharedPerformanceCounter.Verify(CategoryEntry* currentCategoryPointer)
     at System.Diagnostics.SharedPerformanceCounter.FindCategory(CategoryEntry** returnCategoryPointerReference)
     at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime)
     at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
     at System.Diagnostics.PerformanceCounter.Initialize()
     at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
     at System.Data.ProviderBase.DbConnectionPoolCounters.Counter..ctor(String categoryName, String instanceName, String counterName, PerformanceCounterType counterType)
     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..ctor()
     at System.Data.SqlClient.SqlConnectionFactory..cctor()
     --- End of inner exception stack trace ---
     at System.Data.SqlClient.SqlConnection..cctor()</p>
  
  <p>Can any one tell me how to solve this problem? :)</p>