SQL Server SMO on IIS with Windows Auth
I'm getting a strange error when I enable windows authentication on IIS and try to run some database update scripts:
开发者_运维知识库Invalid token for impersonation - it cannot be duplicated.
I have not enabled any explicit impersonation.
I have narrowed it down to being something to do with SMO as when I change to a normal SqlClient
and use ExecuteNonQuery
, the problem goes away. This unfortunately is not a long term solution as the update scripts must be able to contain the 'GO' keyword which is not recognized by the standard SqlClient
.
IIS worker processes are running as some user. When you use windows authentication, you are implicitly doing impersonation to the that user.
If your SQL server is on a different host, this probably isn't good enough. The impersonated user I think can only access local resources.
http://msdn.microsoft.com/en-us/library/ff647405.aspx#paght000025_usingimpersonation
Is SQL Server using windows authentication?
精彩评论