Exception: type initializer for 'system.data.sqlclient.sqlconnection'?

后端 未结 12 947
悲哀的现实
悲哀的现实 2020-12-11 02:35

I couldn\'t figure out what is the problem for this exception.

The type initializer for \'System.Data.SqlClient.SqlConnection\' threw an exception

12条回答
  •  清歌不尽
    2020-12-11 02:51

    sorry for the late response on this, but after investigating this issue for almost 3 days in a row I thought I'd share my results. I had the same error pop up in SQL Server Reporting Services, more specifically the web portal after getting HTTP 503 Service Unavailable errors on my browsers.

    Turns out that the issue was related to both, the service account that runs the SSRS instance plus the account that connects to the database, which in my case was located on another server than the reporting instance. I haven't yet been able to pinpoint exactly where the problem lies inside the configuration and/or user rights, i.e. where do the accounts exactly need elevated rights. All in all seems that the underlying problem was that the account I was running the web portal code under, didn't have enough rights to call on the System.Data.SQLClient type.

    TL;DR: Check your users permissions! Hope this helps someone, I had a long 3 days trying to figure this out.

提交回复
热议问题