Server error in / application

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meskeleton
    New Member
    • Mar 2009
    • 8

    Server error in / application

    Hello everyone...
    I am a newbie to .NET and the having some problem with the site i created and uploaded .
    On accessing the home page i get the error-'Server Error in / application.'
    'An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) '

    I spoke to the people of the hosting company and they say that the problem is with the coding and the server is alrite...
    here is my .cs file code-
    Code:
    protected void Page_Load(object sender, EventArgs e)
    {
                string ConnectionString = "Server=address;Database=db_name;Uid=userid;Pwd=password;";
                SqlConnection conn = new SqlConnection(ConnectionString);
                conn.Open();
                string cmd = "select * from table_name";
                SqlCommand cm = new SqlCommand(cmd, conn);
                SqlDataAdapter da = new SqlDataAdapter(cm);
                DataTable dt = new DataTable();
                da.Fill(dt);
                conn.Close();
                memb.DataSource = dt;
                Page.DataBind();
            }
    Can someone plz help me how to overcome the issue...
    I had made it in the 3.5 framework and their server has 2.0 framework....
    Does the web.config file requires any configuration..

    plz help me out....
    its very urgent....

    thank you...
    Last edited by Frinavale; Apr 3 '09, 02:22 PM. Reason: Added [code] tags. Please post code in [code] [/code] tags.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    When developing any application you need to keep in mind what platform you are developing for.

    In this case it sounds like the server doesn't support the 3.5 Framework and therefore your web application cannot run since it will require references to libraries and resources that aren't available.

    There's a couple things you can do. You could find a web hosting service that does provide support for web applications developed for the 3.5 Framework. Or, if your application doesn't utilize any 3.5 Framework features, you could change your web application to target the 2.0 Framework.

    -Frinny

    Comment

    • meskeleton
      New Member
      • Mar 2009
      • 8

      #3
      Thanx for replying..

      well i realised it later on but i made changes in the web.config file and all the pages that do not require server connectivity are working well...

      the problem comes only where connectivity is required...

      plz suggest something...

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Have you tested this locally before porting/publishing it to the server?
        Does it work locally?

        Specifically, have you tested (locally) connecting to the sql server (that you are using when the application is published)?

        Are you sure that you have provided the correct information in your connection String?

        Are you sure that the SQL Server's configured to allow you to connect to it?

        Comment

        • Sumachechi
          New Member
          • Jul 2009
          • 3

          #5
          Hi

          i was facing the error when opening connection using sqlconnection

          nw got solved


          Blogger ist ein Veröffentlichungs-Tool von Google, mit dem du ganz einfach deine Gedanken der Welt mitteilen kannst. Mit Blogger kannst du problemlos Texte, Fotos und Videos in deinem persönlichen Blog oder deinem Team-Blog veröffentlichen.


          Blogger ist ein Veröffentlichungs-Tool von Google, mit dem du ganz einfach deine Gedanken der Welt mitteilen kannst. Mit Blogger kannst du problemlos Texte, Fotos und Videos in deinem persönlichen Blog oder deinem Team-Blog veröffentlichen.



          See This

          Comment

          • sharifee
            New Member
            • Oct 2008
            • 9

            #6
            Check Your connection string ..
            ConnectionStrin g="data source=(local); initial catalog=dbName; integrated security=SSPI;p ersist security info=False"

            if SqlServer have windows authentication
            other wise have to provide uid=sa;pwd=pwd

            Comment

            Working...