简体   繁体   English

网站连接字符串

[英]Website connectionstring

My asp.net vb website works fine on my pc in Visual Studio 2017. 我的asp.net vb网站在Visual Studio 2017中的PC上运行良好。

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: 当我上传web.config时,我使用:

<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'. CREATE 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. 该网站由Netcetera托管,但是他们的“技术支持”似乎比我少得多。

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 AttachDBFilename = | DataDirectory目录| \\ ASPNET-VF-20150414155129.mdf

ASP.Net is trying to create a new database. ASP.Net试图创建一个新的数据库。 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. 您的托管服务提供商必须允许您访问cPanel,因此您可以随时检查数据库设置。 I say this because this part won't work either 我说这是因为这部分也不起作用

Data Source=.\\SQLEXPRESS <-- this is your PC. 数据源=。\\ SQLEXPRESS <-这是您的PC。 You need the SQL Server Intance settings provided by Netcetera 您需要Netcetera提供的SQL Server Intance设置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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