是否在不使用Visual Studio的情况下获取MS SQL Server连接字符串? [英] Getting MS SQL Server connection string without using visual studio?

查看:51
本文介绍了是否在不使用Visual Studio的情况下获取MS SQL Server连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,目前,在经历了相当多的麻烦之后,我设法获得了我的ASP.NET网站托管在带有IIS和MSQL SERVER 2008 r2的Windows EC2实例上.但是,该网站无法访问数据库,因为连接字符串设置为LOCALHOST \ SQLEXPRESS目录,我在该目录中将数据库托管在自己的计算机上.因此,我将整个数据库复制到了EC2实例.通常,我通过使用Visual Studio的与数据源的连接来生成新的连接字符串,但是由于ec2实例上没有Visual Studio,因此我无法使用该工具来生成新的字符串.如果有帮助,EC2服务器上的名称为WIN-B4PF9V1I0OJ.

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.

webconfig文件中的连接字符串如下所示:

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>

推荐答案

实际上,在没有Windows的情况下,即使没有VS,也很容易获得GUI在任何Windows计算机上创建连接字符串.

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

创建一个空的文本文件,但以".udl"扩展名命名.文件名无关紧要-我使用db.udl.创建文件后,双击它,您将看到一个GUI打开,以指导您构建连接字符串.完成后,在您喜欢的文本编辑器中打开udl文件,然后刮除连接字符串.

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.

这篇关于是否在不使用Visual Studio的情况下获取MS SQL Server连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆