开发者

How to troubleshoot a db permissions issue?

I have web application with two databases; one for dev, the other for production. I have a windows service that connects to the db and uploads data. Based on which db I want to target, I comment out one of the connection strings in my service's app.config.

Everything works fine on my local dev computer, of course. I can switch between dbs using the app.config and data is uploaded to the appropriate db. It's a thing of beauty. Really, it is!

I installed the web app on two new virtual servers. The web app works just fine and connects to the same dbs.

I installed the windows service using the exact same app.config as my local dev box. I'm running the windows service as the same user (my Windows account). However, the service only works with the dev db, not the production db. Let me repeat, the same config file but service can opnly connect to the dev db.

When I switch to using the prod db in the app.config and restart the service, the following exception is logged to the application's event log.

The underlying provider failed on Open.
    System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System开发者_如何学C.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure)

I'm quite sure this is related to permissions but I've run out of ideas for troublshooting this. Any suggestions? How do I figure out which permimssions are needed make the service work with the production db?

EDIT #1 - Straight from the app.config, the production db is "Data Source=ABCD-SQL\prod;" Could there be a problem with the name?

Edit #2 - Verified, from a few sources, the server\instance convention is correct.


Have you checked if the SQL Server service is running? I had the same problem once and by restarting the service it fixed the problem.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜