Aspnet conguration connection test fail after correct configuration - asp.net

I am building web form using VS2012Express edition. I am trying to implement SqlMembership provider. i did the congfiguration and all the neccessary objects are install.i can see the aspnetdb on my db server with all the objects.But when i try to create new user by goin to Project and ASPNET Configuration then Provider tab. i click the test connect and receive this error.Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.
I have done what this error message is telling and have look at several samples on MSDN site. Could the problem be because i have both VS2010 Profession and VS2012 Express installed on my machine or am doing something wrong somewhere?
here is my webconfig.

Related

ASP.NET Core - Application not connecting to database after publishing

I created a simple ASP.Net Core application with user authentication (so all the Entity Framework has been preloaded into the web app template). It is connecting to my database with the connectionString that is located in my appsettings.json file, with "data source = {computerName}\\{serverName}" setup.
The database instance and Visual Studio are located on the same machine. This works fine in returning data to the web api while within development and debugging mode. When I publish it and try to go to the site from a domain name it does allow me to view the webpages that are not needing database connection but the rest that need data from the database returns pages like this:
Error.
An error occurred while processing your request.
Development Mode
Swapping to Development environment will display more detailed information about the error that occurred.
Development environment should not be enabled in deployed
applications, as it can result in sensitive information from
exceptions being displayed to end users. For local debugging,
development environment can be enabled by setting the
ASPNETCORE_ENVIRONMENT environment variable to Development, and
restarting the application.
I have tried to change the Environment Variables for ASPNETCORE_ENVIRONMENT from Development to Production to no success.
I have tried adding appsettings.Production.json to publishOptions in my project.json file, even though there is no file appsettings.Production.json, and this did not help. dotnet publish
Adding the evironment variable in the web.config file did not work Deployment
I need help getting the published web api to connect to my SQL Server database from outside the development Visual Studio setup.
The last thing I can think of is that maybe I am incorrect in how I understand the connection string. If the web api uses the connection string to connect to the database from the server-side then it should work just fine like it does when in development calling to http://localhost:port# since it's all on the same machine. But, if the database string needs to be based on a client-side call then it would have to be with domain names and IP addresses.
Can someone tell me which one it is?
The only thing else that comes to mind is that there is something I am not doing, and need to do, inside of IIS Manager. I see connect string there as well but unsure what that is for our does since the connection string is inside the application. Also maybe I am suppose to give the app some kind of authorization to communicate with the database server even though they are on the same machine???
After much research, finally googling "how to deploy a web api in iis" I was able to learn from Host ASP.NET Web API in IIS using Visual Studio Publish that I needed to add the security entity BUILTIN\IIS_IUSRS. Then placing a mapping to my database tables and giving db_datareader (and possibly db_datawriter) for the database to the IUSER to allow access from my self hosted IIS web api. This from the above mentioned link with the part stating
Accessing Database under IIS APPPOOL\ASP.NET v4.0
As we are using ASP.NET v4.0 App Pool make sure IIS APPPOOL\ASP.NET v4.0 is added to your Database Server -> Security -> Logins.

OAuth2, Azure, Asp.Net MVC5 Default template, cannot access db

In Asp.Net MVC5, I'm using the default template
I've set customer errors of in web.config. I'm trying to connect to google and facebook. When I deploy to azure, i get the following... I've not done anything that I'm aware of locally to prepare the DB. Although I do have sql express installed for other reasons.
error: 52 - Unable to locate a Local Database Runtime installation. Verify that SQL Server Express is properly installed and that the Local Database Runtime feature is enabled.
If I recall correctly when deploying to azure you need to specify a connection string for your project to connect to. In Azure you cant use the DefaultConnection string as it designed only to work locally

ASP.NET Members Section - Cannot create and connect to Database

Visual Studio 2010
MSSQL 2005
Windows Vista
I am creating an ASP.NET website using webforms, I want to create a members section using Web Site Administration Tool. I am following this youtube tutorial (http://www.youtube.com/watch?v=vxxFhGF-Z7E) but I am stuck at 2:58 mins into vid.
After I have created users and roles the vid says ASP.NET should automatically create a Database with tables in the APP_Data section in the Solution explorer in ASP.NET. BUT.... mine doesnt create this database. And when I go into the "Provider" tab in Web Site Administration Tool and test the connection I get an error:
Could not establish a connection to the database.
If you have not yet created the SQL Server database, exit the Web Site Administration tool, use the aspnet_regsql command-line utility to create and configure the database, and then return to this tool to set the provider.
I have looked into lots of solutions online for this but cannot find a solution. Would anyone know what I am doing wrong?
What you need to do is to run the aspnet_regsql you can find that under C:\Windows\Microsoft.NET\Framework\v4.0.30319
if you are using .net4
after running the wizard you should see some tables have been added to your database these are your membership tables
after running this you may need to check your connection string out and ensure that it is correct
if these are all correct
when running the membership you should be able to add users
Thanks Inkey

Publishing ASP.NET site - No login database?

I have a very simple app on my local machine that uses the ASP.NET membership provider. This works fine on my local machine.
I have published the app to our web server, and I need to know the specifics of setting up the application for asp.net membership to work.
I have a basic understanding that it uses an MDF file and somehow connects to a SQL database (SQLEXPRESS I assume on my local machine) which holds the user/role information.
I keep getting an error that it cannot connect to a SQL database when running the published application on the web server.
I wish to use a SQL server on a different machine (SQL69) than my web server (WEB69)
I have created a new connection string, but how do I tell ASP.NET to use it instead of the "LocalSqlServer" connection string that is created by default?
Can someone explain what is required to me?
Thanks for any help you can offer.
Use the ASP.NET SQL Server Registration Tool without any parameters to set up the SQL Server membership on your local machine. This will also update your config file:
http://msdn.microsoft.com/en-us/library/ms229862%28VS.80%29.aspx
You need to set up SQL Server DB membership on your local machine first. After you have this working, you can simply script the entire DB for your production environment. For this, you can use the Database Publishing Wizard in VS.
You can view a sample config file here:
http://www.codersbarn.com/post/2008/02/24/ASPNET-20-Guest-Book-Admin-Part-II.aspx

How to use aspnetdb database with an asp.net website

I have created a website using asp.net 3.5.
And now I have added member support to it using Membership API and aspnetdb database.
And I have done all testing on my local machine.
Now, what issue needs to be considered with respect to aspnetdb while uploading this site to the server. ie; how this database will be available on the server side ?
Note : This is my first ever website.
I was just looking for an answer to this myself.
I've found the following that might help you:
http://www.studiocoast.com.au/knowledgebase/article-6-aspnet-using-sql-server-instead-of-aspnetdbmdf.aspx
"When developing applications in
ASP.NET 2.0, the default option for
roles and users is to use a local SQL
database in the App_Data directory.
This works fine locally, but will
bring up an error when uploaded to a
production server. To fix this the
ASP.NET membership information needs
to be stored in a dedicated SQL Server
database."
"ASP.NET includes a program called
Aspnet_regsql.exe which you can run
locally to configure your database.
More information on the program can be
found here:
http://msdn2.microsoft.com/en-us/library/ms229862.aspx"
Look in your C:\Windows\Microsoft.NET\Framework\v2.0.50727\ folder for the file InstallMembership.sql.
Thats the SQL script to create the database you need.

Resources