2005: cannot to connect from .NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RAM

    2005: cannot to connect from .NET

    Hello,
    Could you help me please to solve the prblem with connecting to SQL Server
    from .NET development environment?
    I have the following error:

    "An error has occured 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 setting SQL Server does not allow remote connections.
    (provider: Named Pipes Provider, error: 40 - Could nott open a connection to
    SQL Server)

    Please help. I changed option for remote connections but it doesn't help.
    /RAM/


  • Erland Sommarskog

    #2
    Re: 2005: cannot to connect from .NET

    RAM (r_ahimsa_m@poc zta.onet.pl) writes:
    Could you help me please to solve the prblem with connecting to SQL Server
    from .NET development environment?
    I have the following error:
    >
    "An error has occured 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 setting SQL Server does not allow remote
    connections. (provider: Named Pipes Provider, error: 40 - Could nott
    open a connection to SQL Server)
    >
    Please help. I changed option for remote connections but it doesn't help.
    Does the server accept connection from Named Pipes? Check this in
    the SQL Server Configuration Manager.

    Have you tried to connect over TCP/IP.

    Also check firewalls etc.


    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server 2005 at

    Books Online for SQL Server 2000 at

    Comment

    • RAM

      #3
      Re: 2005: cannot to connect from .NET

      Does the server accept connection from Named Pipes? Check this in
      the SQL Server Configuration Manager.
      Yes
      Have you tried to connect over TCP/IP.
      I am configuring data source. The message is displayed in Visual Web
      Developer, the problem is not in source code.


      Comment

      • Erland Sommarskog

        #4
        Re: 2005: cannot to connect from .NET

        RAM (r_ahimsa_m@poc zta.onet.pl) writes:
        >Does the server accept connection from Named Pipes? Check this in
        >the SQL Server Configuration Manager.
        >
        Yes
        And client and server agree on the name of the pipe?
        >Have you tried to connect over TCP/IP.
        >
        I am configuring data source. The message is displayed in Visual Web
        Developer, the problem is not in source code.
        Eh? Whether you configure a data source, have a program, or connect from
        a tool like SSMS has nothing do with it. You can still set up the connection
        to use TCP/IP. Usually TCP/IP is preferrable over named pipes.

        Sorry, but I can't help more, because know next to nothing about your
        machines. Are client and server on the same machine or different? Is the
        instance a named instance or a default instance?

        Did you check that the SQL Server Browser service is running and accepts
        remote connections?

        --
        Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

        Books Online for SQL Server 2005 at

        Books Online for SQL Server 2000 at

        Comment

        • RAM

          #5
          Re: 2005: cannot to connect from .NET

          I have noticed something interesting.
          The problem occurs when I am configuring data source control. The connection
          string is taken from web.config:
          <add name="MIMMagazy nDemo" connectionStrin g="Data Source=localhos t;Initial
          Catalog=MIMMaga zynDemo;Integra ted Security=True"
          providerName="S ystem.Data.SqlC lient" />

          I have noticed that the problem do not exist when I change localhost to
          PC\SQLEXPRESS (PC is name of my computer).

          Could you explain me why? Thank you!

          /RAM/




          Comment

          • Erland Sommarskog

            #6
            Re: 2005: cannot to connect from .NET

            RAM (r_ahimsa_m@poc zta.onet.pl) writes:
            I have noticed something interesting.
            The problem occurs when I am configuring data source control. The
            connection string is taken from web.config:
            ><add name="MIMMagazy nDemo" connectionStrin g="Data Source=localhos t;Initial
            Catalog=MIMMaga zynDemo;Integra ted Security=True"
            providerName="S ystem.Data.SqlC lient" />
            >
            I have noticed that the problem do not exist when I change localhost to
            PC\SQLEXPRESS (PC is name of my computer).
            >
            Could you explain me why? Thank you!
            SQL Server permits you to install several instances on the same machine.
            One of these instances can be a default instances, all other instances
            must be named.

            When you refer to a default instance, you refer only to the machine name,
            or, if you are on the machine itself, you can use ".", "localhost" or
            "(local)" instead.

            When you refer to a named instance, you must also include the instance
            name separated from the machine name with a backslash, for instance
            MYSERVER\MY2NDI NSTANCE.

            By default, SQL Server Express is installed as a named instance as
            SQLEXPRESS, and thus "localhost" alone will not work on a machine that
            only has SQL Express.

            --
            Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

            Books Online for SQL Server 2005 at

            Books Online for SQL Server 2000 at

            Comment

            • RAM

              #7
              thank you

              Thank you very much

              Uzytkownik "Erland Sommarskog" <esquel@sommars kog.senapisal w wiadomosci
              news:Xns98189D2 68B5C9Yazorman@ 127.0.0.1...
              RAM (r_ahimsa_m@poc zta.onet.pl) writes:
              >I have noticed something interesting.
              >The problem occurs when I am configuring data source control. The
              >connection string is taken from web.config:
              >><add name="MIMMagazy nDemo" connectionStrin g="Data Source=localhos t;Initial
              >Catalog=MIMMag azynDemo;Integr ated Security=True"
              >providerName=" System.Data.Sql Client" />
              >>
              >I have noticed that the problem do not exist when I change localhost to
              >PC\SQLEXPRES S (PC is name of my computer).
              >>
              >Could you explain me why? Thank you!
              >
              SQL Server permits you to install several instances on the same machine.
              One of these instances can be a default instances, all other instances
              must be named.
              >
              When you refer to a default instance, you refer only to the machine name,
              or, if you are on the machine itself, you can use ".", "localhost" or
              "(local)" instead.
              >
              When you refer to a named instance, you must also include the instance
              name separated from the machine name with a backslash, for instance
              MYSERVER\MY2NDI NSTANCE.
              >
              By default, SQL Server Express is installed as a named instance as
              SQLEXPRESS, and thus "localhost" alone will not work on a machine that
              only has SQL Express.
              >
              --
              Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se
              >
              Books Online for SQL Server 2005 at

              Books Online for SQL Server 2000 at
              http://www.microsoft.com/sql/prodinf...ons/books.mspx

              Comment

              Working...