web.config

Discussion in 'Databases' started by kobra007, Jan 18, 2009.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm trying to connect my database with Visual Developer 2008 Express Edition but it doesn't work.
    my web.config connection sting was:



    <add name="InfoConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\InfoDatabase.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />


    and now I did it like this:


    <add name="InfoConnectionString" connectionString="Data Source=tcp:sql2k801.discountasp.net;Initial Catalog=SQL2008_586730_aspdb;User ID=SQL2008_586730_aspdb_user;Password=password;" providerName="System.Data.SqlClient" /> What's the problem??
     
  2. Bruce

    Bruce DiscountASP.NET Staff

  3. the error is:


    System.Data.SqlClient.SqlException was unhandled by user code
    Message="A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.)"
    Source=".Net SqlClient Data Provider"
    ErrorCode=-2146232060
    Class=20
    LineNumber=0
    Number=10060
    Server=""
    State=0
    StackTrace:
    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
    at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
    at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
    at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
    at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
    at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
    at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
    at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
    at System.Data.SqlClient.SqlConnection.Open()
    at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState&amp; originalState)
    at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
    at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
    at System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments)
    at System.Web.UI.WebControls.SqlDataSource.Select(DataSourceSelectArguments arguments)
    at _ClientPage.questionsList_SelectedIndexChanged(Object sender, EventArgs e) in c:\Users\Servsmart\Documents\livemall-lb\ClientPage.master.cs:line 574
    at _ClientPage.Help_Load(Object sender, EventArgs e) in c:\Users\Servsmart\Documents\livemall-lb\ClientPage.master.cs:line 341
    at _ClientPage.Page_Load(Object sender, EventArgs e) in c:\Users\Servsmart\Documents\livemall-lb\ClientPage.master.cs:line 331
    at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
    at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
    at System.Web.UI.Control.OnLoad(EventArgs e)
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Control.LoadRecursive()
    at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    InnerException:
     
  4. Bruce

    Bruce DiscountASP.NET Staff

    i assumed you are getting this error on your home computer. I would check to make sure that your network or ISP allows port 1433 to go through.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  5. well can u give me a code to get something from a connection please.
     
  6. Hi,
    I'm not an employee of DASP and do not have access to your site code but here is an updated IIS7 web.config with SMTP and example SQL settings:

     
  7. IIS7, version 3.5


    yes man web.config and if you can check my website www.livemall-lb.com/LiveMall.aspx and figure out the problem, this is the code:


    ConnectionStringSettings helpString = ConfigurationManager.ConnectionStrings["InfoConnectionString"];


    SqlDataSource helpSource = new SqlDataSource(helpString.ConnectionString, "SELECT Question, Answer FROM Help ORDER BY Question");





    IEnumerable helpID = helpSource.Select(DataSourceSelectArguments.Empty); // The error occures here


    foreach (DataRowView row in helpID)


    {


    if (row["Question"].ToString().Contains(questionsList.SelectedValue))


    answerText.Text = row["Answer"].ToString();


    }





    thx so much
     
  8. no man this is not the problem, i know how to use the .mdf upload tools, but the problem is when working with a local database my website works correctly.


    but when connecting to discountasp.net database it give me an error!!!!!


    if someone can help me please it's very important.
     
  9. thx man so much my web.config is correct, so the problem is from the above code.


    can you please correct it to me.


    when i connect to a local database (.mdf) it works, when connection to my discountasp.net database it gave me the error above :(
     
  10. Hi,
    If you want me to try and figure this out for you by taking a look at your site code PM me with your Control Panel login info.
    Other than that I can't offer much help with this. (Actually none of us can unless we take a look for you.)
    Salute,
    Mark

    Technical Evangelist for DiscountASP.NET

    Find ASP.NET code samples with my Dev Coop search tools below.
    Google
    Microsoft

    DiscountASP.NET Technical Webcasts:
    http://www.iis7test.com/webcasts/

    My Microsoft Technical Blogs
    http://weblogs.asp.net/markwisecarver/
    http://blogs.windowsclient.net/wisecarver/default.aspx
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page