开发者

Asp.Net Impersonation Fails On First Try But Succeeds on Second

We are using R开发者_运维百科DLC's in a Asp.net web application. For reasons beyond our understanding, the first call to the database server fails with the following error:

An error has occurred during report processing. Cannot open database "TryParkingIt2" requested by the login. The login failed. Login failed for user 'EXTRANET\OurServerNameHere$'.

Run the report again, it works.

Huh?

Update Click the button the first time, it fails. Click the button again, it works. The account being impersonated is a domain account. Also, this error occurs on all five different report pages, which is why I didn't include any code.


Look for static constructors or global.asax code that is failing. Those are run only once when the application starts up (actually for static constructors are run when the class is first accessed), so often they will cause a failure the first time, and then everything seems to work fine after that (even though something is really busted up in the background).

BTW, this is a GREAT reason to avoid static constructors.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜