简体   繁体   中英

Getting MS SQL Server connection string without using visual studio?

so currently, I have after a fair amount of trouble, managed to get my ASP.NET website hosted on an windows EC2 instance with IIS and MSQL SERVER 2008 r2. However, the website is unable to access the database because the connection string is set to the directory LOCALHOST\\SQLEXPRESS where i was hosting the database on my own computer. So I copied the entire database over to the EC2 instance. Usually I generate a new connection string by using visual studio's connect to datasource but seeing as there is no visual studio on my ec2 instance, I cannot use that facility to generate the new string. the name on the EC2 server is WIN-B4PF9V1I0OJ if it's any help.

the connection string in the webconfig file looks like this :

<connectionStrings>
    <add name="YubiDBEntities" connectionString="metadata=res://*/App_Code.Model.csdl|res://*/App_Code.Model.ssdl|res://*/App_Code.Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=LOCALHOST\SQLEXPRESS;initial catalog=YubiDB;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
    <add name="YubiDBConnectionString" connectionString="Data Source=LOCALHOST\SQLEXPRESS;Initial Catalog=YubiDB;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework" providerName="System.Data.SqlClient" />
  </connectionStrings>

It's actually pretty easy to get a GUI to create a connection string on any Windows computer, even without VS.

Create an empty text file, but name it with a ".udl" extension. The file name does not matter--I use db.udl. Once the file is created, double-click on it and you will see a GUI open up to guide you building your connection string. Once done, open the udl file up in your favorite text editor and scrape out the connection string.

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