[英]Database connection not established in published asp.net website
I have developed a web application in asp.net , and have published that website in iis 7. I have given full access to the published folder and it works perfectly.When i browse my published application the login page has been loaded initially. 我已经在asp.net中开发了一个Web应用程序,并已在iis 7中发布了该网站。我具有对已发布文件夹的完全访问权限,并且它可以完美地运行。当我浏览已发布的应用程序时,登录页面最初已加载。 If i fill the details and tried to login there connection fails.SQL connection has noot been opened
如果我填写详细信息并尝试登录, 则连接失败.SQL连接已打开
webConfig i have 我有的webConfig
<add name="SQLSERVER2008ConString" connectionString="Data Source=(local);Initial Catalog=REPOSITY;Integrated Security=True" providerName="System.Data.SqlClient"/>
and for opening connection 并用于打开连接
SqlConnection con = new SqlConnection(conString);
con.Open();
here the connection is not getting opened.But it works perfectly in my development environment.But not working after i published the code. 这里的连接没有打开,但是在我的开发环境中可以正常工作,但是在我发布代码后却无法正常工作。 this how i connect my sql in local
这是我如何在本地连接我的sql
Note: 注意:
thanks 谢谢
use this code 使用此代码
String conString= System.Configuration.ConfigurationManager.ConnectionStrings["SQLSERVER2008ConString"].ConnectionString;
SqlConnection con = new SqlConnection(conString);
con.Open();
Are you sure your SQL Local Login Name is (local) ? 您确定您的SQL本地登录名是(local)吗? Check the name once.
一次检查名称。 But If Yes, then try this:
<add name="SQLSERVER2008ConString" connectionString="Data Source=(local);Initial Catalog=REPOSITY;Integrated Security=True" User Id = [ENTER YOUR WINDOWS LOGIN USERNAME];Password = [ENTER YOUR WINDOWS LOGIN PASSWORD]"/>
但是,如果是,则尝试以下操作:
<add name="SQLSERVER2008ConString" connectionString="Data Source=(local);Initial Catalog=REPOSITY;Integrated Security=True" User Id = [ENTER YOUR WINDOWS LOGIN USERNAME];Password = [ENTER YOUR WINDOWS LOGIN PASSWORD]"/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.