Error connecting to SQL Server through a Web Service???

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

    #1

    Error connecting to SQL Server through a Web Service???

    I'm trying to connect my application with a web service located on my own web
    server(localhos t).

    I guess when the solution/proect is built it makes a file called 'Web
    References\loca lhost\Reference s.vb'

    In this file a line of code reports the following error:

    Line of code:
    Dim results() As Object = Me.Invoke("GetC ustomers", New Object() {Country})

    Error:
    An unhandled exception of type 'System.Web.Ser vices.Protocols .SoapException'
    occurred in system.web.serv ices.dll

    Additional information: Server was unable to process request. --> Login
    failed for user 'myserver\ASPNE T'.

    My WebService is trying to connect and execute a query on MS SQL Server
    database.

    What is causing this error?
    Login failed for user '......

    Where is the 'ASPNET' comming from in the login failed for user
    'myserver\ASPNE T'?

    --
    Sincerely,

    Keith
  • Drew Marsh

    #2
    Re: Error connecting to SQL Server through a Web Service???

    GTDriver wrote:
    [color=blue]
    > What is causing this error?
    > Login failed for user '......
    > Where is the 'ASPNET' comming from in the login failed for user
    > 'myserver\ASPNE T'?[/color]

    Looks like your SqlConnection string is setup to use Windows authentication.
    The ASP.NET worker process runs as that account that you're seeing. Therefore
    if you need your web service application to login to the database using Windows
    authentication you need to permit yourdomain\ASPN ET to the database (I suggest
    with very low permissions) or you need to change your web service application
    to run as a different Windows user (all kinds of security considerations
    to make there). I usually use the latter, but you just need to be very careful
    what rights you grant that account.

    As another option, you can change your connection string to use SQL authentication
    (which has it's own considerations) .

    HTH,
    Drew

    _______________ _______________ _____
    Drew Marsh
    Chief Software Architect
    Mimeo, Inc. - http://www.mimeo.com
    Weblog - http://blog.hackedbrain.com

    Comment

    • GTDriver

      #3
      Re: Error connecting to SQL Server through a Web Service???

      Drew - Thanks , I added ASPNET user to the database and it worked fine.

      However, I noticed when I try to use this webservice, I have to be connected
      to the internet. This webservice is on my local machine( the webserver on my
      Win2K profesional pc). I'm not trying to get any ohter info other than
      connect to SQL Server database and return the query.

      Why do I have to be connected to the Internet for this to work?

      Thanks,

      Keith

      "Drew Marsh" wrote:
      [color=blue]
      > GTDriver wrote:
      >[color=green]
      > > What is causing this error?
      > > Login failed for user '......
      > > Where is the 'ASPNET' comming from in the login failed for user
      > > 'myserver\ASPNE T'?[/color]
      >
      > Looks like your SqlConnection string is setup to use Windows authentication.
      > The ASP.NET worker process runs as that account that you're seeing. Therefore
      > if you need your web service application to login to the database using Windows
      > authentication you need to permit yourdomain\ASPN ET to the database (I suggest
      > with very low permissions) or you need to change your web service application
      > to run as a different Windows user (all kinds of security considerations
      > to make there). I usually use the latter, but you just need to be very careful
      > what rights you grant that account.
      >
      > As another option, you can change your connection string to use SQL authentication
      > (which has it's own considerations) .
      >
      > HTH,
      > Drew
      >
      > _______________ _______________ _____
      > Drew Marsh
      > Chief Software Architect
      > Mimeo, Inc. - http://www.mimeo.com
      > Weblog - http://blog.hackedbrain.com/
      >
      >[/color]

      Comment

      • Dan Rogers

        #4
        Re: Error connecting to SQL Server through a Web Service???

        How is your network connection managed? The calls to SQL server can go
        over either TCP/IP or over named pipes. If your SQL client is configured
        for TCP/IP, then you need a valid network connection to talk to SQL Server.

        I hope this helps

        Dan Rogers
        Microsoft Corporation
        --------------------
        Thread-Topic: Error connecting to SQL Server through a Web Service???
        thread-index: AcTX3tYEVMW3Zl0 ETZOgKNJRjwF+vw ==
        X-WBNR-Posting-Host: 4.158.243.47
        From: "=?Utf-8?B?R1REcml2ZXI =?=" <GTDriver@discu ssions.microsof t.com>
        References: <C5702BC1-3C1C-486F-A03D-3555BAA7D303@mi crosoft.com>
        <85659632373527 930781250@msnew s.microsoft.com >
        Subject: Re: Error connecting to SQL Server through a Web Service???
        Date: Wed, 1 Dec 2004 11:49:14 -0800
        Lines: 44
        Message-ID: <01B3C703-6CC4-4275-AA45-FE40302DAA19@mi crosoft.com>
        MIME-Version: 1.0
        Content-Type: text/plain;
        charset="Utf-8"
        Content-Transfer-Encoding: 7bit
        X-Newsreader: Microsoft CDO for Windows 2000
        Content-Class: urn:content-classes:message
        Importance: normal
        Priority: normal
        X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
        Newsgroups: microsoft.publi c.dotnet.framew ork.webservices
        NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.1.29
        Path: cpmsftngxa10.ph x.gbl!TK2MSFTNG XA03.phx.gbl
        Xref: cpmsftngxa10.ph x.gbl
        microsoft.publi c.dotnet.framew ork.webservices :7727
        X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.webservices

        Drew - Thanks , I added ASPNET user to the database and it worked fine.

        However, I noticed when I try to use this webservice, I have to be
        connected
        to the internet. This webservice is on my local machine( the webserver on
        my
        Win2K profesional pc). I'm not trying to get any ohter info other than
        connect to SQL Server database and return the query.

        Why do I have to be connected to the Internet for this to work?

        Thanks,

        Keith

        "Drew Marsh" wrote:
        [color=blue]
        > GTDriver wrote:
        >[color=green]
        > > What is causing this error?
        > > Login failed for user '......
        > > Where is the 'ASPNET' comming from in the login failed for user
        > > 'myserver\ASPNE T'?[/color]
        >
        > Looks like your SqlConnection string is setup to use Windows[/color]
        authentication.[color=blue]
        > The ASP.NET worker process runs as that account that you're seeing.[/color]
        Therefore[color=blue]
        > if you need your web service application to login to the database using[/color]
        Windows[color=blue]
        > authentication you need to permit yourdomain\ASPN ET to the database (I[/color]
        suggest[color=blue]
        > with very low permissions) or you need to change your web service[/color]
        application[color=blue]
        > to run as a different Windows user (all kinds of security considerations
        > to make there). I usually use the latter, but you just need to be very[/color]
        careful[color=blue]
        > what rights you grant that account.
        >
        > As another option, you can change your connection string to use SQL[/color]
        authentication[color=blue]
        > (which has it's own considerations) .
        >
        > HTH,
        > Drew
        >
        > _______________ _______________ _____
        > Drew Marsh
        > Chief Software Architect
        > Mimeo, Inc. - http://www.mimeo.com
        > Weblog - http://blog.hackedbrain.com/
        >
        >[/color]

        Comment

        Working...