How to allow IIS to use local database from ASP.NET MVC project?

后端 未结 4 1027
南笙
南笙 2020-12-05 16:31

I\'m going to be demoing a ASP.NET MVC website on a local network. This application has a connection to a database:


    

        
4条回答
  •  执念已碎
    2020-12-05 16:50

    I solved it like this:

    Start by using Developer PowerShell or Developer Command Prompt for Visual Studio as Administrator and confirm that you only have one instance of LocalDb.

    Type sqllocaldb info to see your LocalDb instances.

    I then followed this article and had Application Pool Identity set to my currently logged in user, credit: https://stackoverflow.com/a/38294458/3850405

    https://docs.microsoft.com/en-us/archive/blogs/sqlexpress/using-localdb-with-full-iis-part-1-user-profile

    In there I found that it is not enough to have Load User Profile set to true for your Application Pool, you also need to set setProfileEnvironment to true in applicationHost.config normally located at C:\Windows\System32\inetsrv\config. With this configuration it worked:

    Original answer:

    https://stackoverflow.com/a/62810876/3850405

提交回复
热议问题