Consume a webservice in a WebApplicationnew
-
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
-
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
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
-
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
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
-
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
-
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.
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
-
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
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...
-
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...