开发者

Is it possible to make the ApplicationPoolIdentity attach a database with User Instance = true?

I use the "real" IIS 7.5 server in the development phase. The site points to the web project folder which contains WebProjectDir\App_Data\database.mdf.

The site runs under ApplicationPoolIdentity as follows:

Is it possible to make the ApplicationPoolIdentity attach a database with User Instance = true?

When I run the application I get the following errors:

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Pl开发者_StackOverflow社区ease make sure the user has a local user profile on the computer. The connection will be closed.

Source Error:

Line 14:         public ActionResult Index()
Line 15:         {
Line 16:             return View(db.Genres.ToList());
Line 17:         }
Line 18: 


Source File: G:\MvcMusicStore\Controllers\StoreController.cs    Line: 16 

I can remove these errors by setting the application to run under NetworkService. However, I want to use ApplicationPoolIdentiy if it is possible with any adjustment. How to do this?


That error relates to SQL Express.

Take a look at this thread:
http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/527bf46a-b3fe-4ae6-8b41-eb40024399c8/

The problem is that any account that connects directly to an MDF file through SQL Express must have a local user profile. If you have the full version of SQL Server running on that server (or another), you should be able to attach that MDF file as a database and connect that way. Otherwise your application pool will have to run under an account that has a profile, like NETWORK SERVICE.


@Dave, I found the solution yesterday.

Setting Load User Profile to True will make the ApplicationPoolIdentity able to attach the database.

Is it possible to make the ApplicationPoolIdentity attach a database with User Instance = true?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜