I have published the ASP.NET MVC web site on a virtual machine (Hyper-V) on a server. Install SQL Server Express on the same server
The problem is that the ASP.NET subscription system does not work in unified mode. When the Web.config file contains the following types of records:
& lt; Connection best & gt; & Lt; Remove name = "Local SQL Server" /> & Lt; Adding name = "MyDBConnectionString" connectionstring = "data source = VM-1 \ SQLEXPRESS; initial list = testdb; integrated security = SSPI," ProviderName = "System.Data.SqlClient" /> & Lt; / ConnectionStrings & gt;
I get an error when trying to login to the site and login.
If I change the connection string like this:
& lt; ConnectionStrings & gt; & Lt; Remove name = "Local SQL Server" /> & Lt; Add name = "MyDBConnectionString" connectionString = "data source = VM-1 \ SQLEXPRESS; initial catalog = testdb; user id = XX; password = XXXXXXX;" ProviderName = "System.Data.SqlClient" /> & Lt; / ConnectionStrings & gt;
I could register and login without any problems.
What could be the cause of the problem in using ASP.NET membership database in integrated security mode?
If you do not use impersonation then you need to provide access to membership objects for the account Running under the ASP.NET process. Its most likely is NETWORKSERVICE
. When you create subscription items with aspnet_regsql.exe, it is also the corresponding SP Creates special roles (such as aspnet_membership_BasicAccess
, etc.) with permission to execute. Then create a login for the NETWORKSERVICE
account, add a user to your database for that entry and grant it one of those aspnet _
roles.
Follow the script I (should be run as a database administrator) Use the form of my database deployment:
does not exist (of Select * Login from LOGINNAME = N'NT AUTHORITY \ NETWORK SERVICE '* Master.dbo.syslogins] [NT AUTHORITY \ NETWORK SERVICE] Create WINDOWS GO [NT AUTHORITY \ NETWORK SERVICE] to login [NT AUTHORITY \ NETWORK SERVICE] with DEFAULT_SCHEMA = [dbo] GRANT to connect [NT AUTHORITY \ NETWORK SERVICE] Go Go Executive sp_addrolemember 'aspnet_Me Mbership_BasicAccess', 'NT AUTHORITY \ NETWORK SERVICE' Go Executive Sp_addrolemember 'aspnet_Roles_BasicAccess',' NT AUTHORITY \ NETWORK SERVICE 'Go
Comments
Post a Comment