I am following the tutorial https://docs.microsoft.com/en-us/aspnet/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project and https://www.codeproject.com/Articles/751897/ASP-NET-Identity-with-webforms for adding Identity Module in my existing web form project.
When trying to register any new user I am getting error as:
Server Error in '/' Application. Directory lookup for the file "c:\users\scala\documents\visual studio 2015\Projects\RENTAL\RENTAL\App_Data\WebFormsIdentity.mdf" failed with the operating system error 5(Access is denied.). CREATE DATABASE failed. Some file names listed could not be created. Check related errors. 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: Directory lookup for the file "c:\users\scala\documents\visual studio 2015\Projects\RENTAL\RENTAL\App_Data\WebFormsIdentity.mdf" failed with the operating system error 5(Access is denied.). CREATE DATABASE failed. Some file names listed could not be created. Check related errors.
I've Microsoft SQL Server 2014 installed and VS 2015 and my OS is Windows10. Most of the solutions said to allow permission for the App_Data folder, but I did not understand what kind of permission do I need to give.
My connection string
<connectionStrings><add name="DefaultConnection" connectionString="Data Source= DESKTOP-07C7H66;Initial Catalog=WebFormsIdentity;AttachDbFilename=|DataDirectory|\WebFormsIdentity.mdf;Trusted_Connection=Yes;Integrated Security=True" providerName="System.Data.SqlClient" /></connectionStrings>
Please help me how can I solve this problem. Thank You!
I checked the following commands ::
PM> Get-Service | Where-Object {$_.Name -like '*SQL*'}
Status Name DisplayName
------ ---- -----------
Running MSSQLFDLauncher SQL Full-text Filter Daemon Launche...
Running MSSQLSERVER SQL Server (MSSQLSERVER)
Running MSSQLServerOLAP... SQL Server Analysis Services (MSSQL...
Stopped SQLBrowser SQL Server Browser
Stopped SQLSERVERAGENT SQL Server Agent (MSSQLSERVER)
Running SQLWriter SQL Server VSS Writer
PM> SqlLocalDb info
MSSQLLocalDB
PM> Then changed my connection sting to
<connectionStrings><add name="DefaultConnection" connectionString="Data Source= .\SQLEXPRESS;Initial Catalog=WebFormsIdentity;AttachDbFilename=|DataDirectory|\WebFormsIdentity.mdf;Trusted_Connection=Yes;Integrated Security=True" providerName="System.Data.SqlClient" /></connectionStrings>
getting error as::
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)
Again I tried changing the connection string as ::
<connectionStrings><add name="DefaultConnection" connectionString="Data Source=MSSQLLocalDB;Initial Catalog=WebFormsIdentity;AttachDbFilename=|DataDirectory|\WebFormsIdentity.mdf;Trusted_Connection=Yes;Integrated Security=True" providerName="System.Data.SqlClient" /></connectionStrings>
then get anther error::
Invalid value for key 'attachdbfilename'. 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.ArgumentException: Invalid value for key 'attachdbfilename'.
I can not understand how to solve this problem. Please help!!!