Getting MS SQL Server connection string without using visual studio?

感情迁移 提交于 2021-01-21 10:20:43

问题


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>

回答1:


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.



来源:https://stackoverflow.com/questions/28992243/getting-ms-sql-server-connection-string-without-using-visual-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!