Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Consume a webservice in a WebApplicationnew

Consume a webservice in a WebApplicationnew

Scheduled Pinned Locked Moved C#
helpcsharpsysadmin
7 Posts 3 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AS 13
    wrote on last edited by
    #1

    Hell EveryBody, I have a webservice in a server.And in another server I have a webApplication. When i use the webmethod of the webservice in my webApplication I got the following error. I had already used this code, but no result. webservLeave.PreAuthenticate = false; webservLeave.Credentials = System.Net.CredentialCache.DefaultCredentials; or webservLeave.Credentials = System.Net.CredentialCache.DefaultCredentials; The request failed with HTTP status 401: Unauthorized plz help me out.

    A key to every Solution

    N 1 Reply Last reply
    0
    • A AS 13

      Hell EveryBody, I have a webservice in a server.And in another server I have a webApplication. When i use the webmethod of the webservice in my webApplication I got the following error. I had already used this code, but no result. webservLeave.PreAuthenticate = false; webservLeave.Credentials = System.Net.CredentialCache.DefaultCredentials; or webservLeave.Credentials = System.Net.CredentialCache.DefaultCredentials; The request failed with HTTP status 401: Unauthorized plz help me out.

      A key to every Solution

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      AS@13 wrote:

      The request failed with HTTP status 401: Unauthorized

      Looks like anonymous access is not enabled. Allow anonymous access in the server or supply valid credentials instead of default credentials.

      All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

      A 1 Reply Last reply
      0
      • N N a v a n e e t h

        AS@13 wrote:

        The request failed with HTTP status 401: Unauthorized

        Looks like anonymous access is not enabled. Allow anonymous access in the server or supply valid credentials instead of default credentials.

        All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

        A Offline
        A Offline
        AS 13
        wrote on last edited by
        #3

        I had already done this,but no result. plz tell me some other option. my code is as below.... MyWS.Service webservLeave = null; if (webservLeave == null) { webservLeave = new MyWS.Service(); } webservLeave.PreAuthenticate = false; webservLeave.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; webservLeave.Credentials = CredentialCache.DefaultCredentials; webservLeave.MyWebMethod(); Thanks in Advance

        A key to every Solution

        E 1 Reply Last reply
        0
        • A AS 13

          I had already done this,but no result. plz tell me some other option. my code is as below.... MyWS.Service webservLeave = null; if (webservLeave == null) { webservLeave = new MyWS.Service(); } webservLeave.PreAuthenticate = false; webservLeave.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials; webservLeave.Credentials = CredentialCache.DefaultCredentials; webservLeave.MyWebMethod(); Thanks in Advance

          A key to every Solution

          E Offline
          E Offline
          enginco
          wrote on last edited by
          #4

          Did you try to call .asmx file from explorer? You can see your webService methohds. Are there any methods? If there aren't any methods you must edit WebService application's security in IIS.

          A 1 Reply Last reply
          0
          • E enginco

            Did you try to call .asmx file from explorer? You can see your webService methohds. Are there any methods? If there aren't any methods you must edit WebService application's security in IIS.

            A Offline
            A Offline
            AS 13
            wrote on last edited by
            #5

            yes boss, I had check it from Internet Explorer.It runs fine and also shows the desire method. Problem occurs when I access it though my app.

            A key to every Solution

            E 1 Reply Last reply
            0
            • A AS 13

              yes boss, I had check it from Internet Explorer.It runs fine and also shows the desire method. Problem occurs when I access it though my app.

              A key to every Solution

              E Offline
              E Offline
              enginco
              wrote on last edited by
              #6

              I did a new webService and I used it in a webApp. WebReferances => MyNewWebService... MyNewWebService.MyMethods mm = new MyNewWebService.MyMethods(); double dd = mm.CalSum(1d, 155d); in IIS: MyWebService => Properties => security it has : Everyone read&execute rights, IIS_IUSRS read&execute rights. voila... it is working. and I didn't use credentials to call methods...

              A 1 Reply Last reply
              0
              • E enginco

                I did a new webService and I used it in a webApp. WebReferances => MyNewWebService... MyNewWebService.MyMethods mm = new MyNewWebService.MyMethods(); double dd = mm.CalSum(1d, 155d); in IIS: MyWebService => Properties => security it has : Everyone read&execute rights, IIS_IUSRS read&execute rights. voila... it is working. and I didn't use credentials to call methods...

                A Offline
                A Offline
                AS 13
                wrote on last edited by
                #7

                Hi, I had done this. But no result. plz give me a optimize solution. Thanks in advance

                A key to every Solution

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups