简体   繁体   中英

Website connectionstring

My asp.net vb website works fine on my pc in Visual Studio 2017.

My local connection strings are:

  <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-VF-20150414155129;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-VF-20150414155129.mdf" />
  <add name="VIConnectionString1" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Renaissance.mdf;Integrated Security=True;User Instance=True"  />

When I upload web.config I use:

<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;AttachDBFilename=|DataDirectory|\aspnet-VF-20150414155129.mdf;Initial Catalog=aspnet-VF-20150414155129;User Id=vflogin;Password=mypassword" />
<add name="VIConnectionString1" providerName="System.Data.SqlClient" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Renaissance.mdf;Initial Catalog=Renaissance.mdf;User Id=vf_vi;Password=mypassword" />

The error message I get is when I access a webpage that tries to use the database:

CREATE DATABASE permission denied in database 'master'.

When I access a webpage that does not use the database it works fine.

I've spent three days on this. The site is hosted by Netcetera but their "tech support" seems to know considerably less than me.

If any guru out there can answer this it would be much appreciated.

The problem is caused because of this part of the connection string :

AttachDBFilename=|DataDirectory|\\aspnet-VF-20150414155129.mdf

ASP.Net is trying to create a new database. You should create the database or restore a backup, remove the string above and try again.

Your hosting provider had to give you access to the cPanel, so you can check your database settings anytime. I say this because this part won't work either

Data Source=.\\SQLEXPRESS <-- this is your PC. You need the SQL Server Intance settings provided by Netcetera

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM