Last post Feb 27, 2013 07:54 AM by sue At Elmira
Feb 25, 2013 11:00 AM|sue At Elmira|LINK
I am trying to create a website which has some pages limited to logged in users. I can make it work on my local machine but cannot work out how to point to a remote database.
I have created the remote SQL database using regsql, the command looks like this:
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regsql.exe -S "Server" -U UserName -P Password-A all -d database"
I guess this worked as when I look at my database I can see all the relevant tables, Users, Roles Membership etc.
I then click on Configure ASP.NET to use the administration tool. I tried to set up using Internet as the security option and this tells me to go onto the provider tab. I go to the Provider tab and all I can do is click on test which fails ans tells me
to go to regsql which I have already done.
What have I missed out??
Feb 25, 2013 11:25 AM|adamturner34|LINK
Is your connection string in the web.config pointing to the remote db or your local one?\
Feb 25, 2013 11:50 AM|sue At Elmira|LINK
The remote db with this command..
the configuration tool on the provider page I get:
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
in security I get:
is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where
you can choose a new data store.
The following message may help in diagnosing the problem:
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
error I get if I run it is :
Feb 25, 2013 12:11 PM|adamturner34|LINK
Yes that data source is expecting the database locally. You need to give it a protocol such as http:// and the database much allow remote connections
Feb 25, 2013 12:28 PM|sue At Elmira|LINK
OK, that makes sense, I tried changing the web.config to say:
I still get this error..
my syntax correct? Do I need to run the regsql tool again?
have used this database for other aspects of my websites without a problem so I assume it accepts remote connections, could different tables have different settings?
Feb 25, 2013 12:33 PM|adamturner34|LINK
Before I did anything else, I would put that URL into management studio using Windows Authentication to see if you can connect. If you can't connect that way, the problem isn't in your application, it's in the database configuration.
Feb 25, 2013 12:41 PM|sue At Elmira|LINK
OK, I am using management studio with SQL authentication and I can't get to it using Windows Authenication so I guess that is my problem. I will try and change my database configuration.
Many thanks for your help
Feb 25, 2013 12:52 PM|sue At Elmira|LINK
Is this something I can change within Server management studio??
I am a bit confused, I thought the idea of using authentication mode=forms was to avoid logging in via windows??
Feb 25, 2013 12:56 PM|adamturner34|LINK
No...forms authentication uses a login/password.
To save yourself the headache and for security reasons, you can use forms authentication. Windows Authentication on a remote database is as dangerous as it gets. All someone would have to do to hack in is change the PC Name and create an account the same
as yours. There is no password protection.
Feb 25, 2013 12:57 PM|adamturner34|LINK
Create an acccount on your remote database and try to login using Management Studio w/SQL Authentication
Feb 25, 2013 01:10 PM|sue At Elmira|LINK
Sorry I'm not sure what you mean...
I know I can create a user on the remote database and login to the database via Management studio using SQL authentication, or do you mean create a User for my website which uses SQL authentication?? If it is the latter I don't see how I can do that....
Feb 27, 2013 07:54 AM|sue At Elmira|LINK
Hi, problem now resolved. The only issue was my connection string.. the format of this which worked is:
<add name="ApplicationServices" connectionString="Data Source="mssql.aspnethosting.co.uk, 14330";Persist Security Info=True;User ID=XXX;Password=XXX;Initial Catalog=XXX_Database" providerName="System.Data.SqlClient" />