When fetch data from Web services
system generate error
Request Faild with Http Status 401 : Unaothorised
Plzzzzzzz HelppIt is extremely aggravating to see a post like this which, without any details, tells us just a generic error and fails to mention any other details which may help us in pointing the poster towards a solution. This one here, this is like going up to a car mechanic and saying "My car made a noise and now it's broken. Please fix it, thanks and bye bye for now."
We're here to help, but you have to help us help you.
The error you've gotten is too generic to point towards any one cause for it. It could be authentication on the server or it could be ACL. We won't know until you give us details.
this is web services file
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Data.OleDb;
using System.Web.Mail;
using System.Text.RegularExpressions;
namespace testService
{
/// <summary>
/// Summary description for Service1.
/// </summary>
///
[WebService(Namespace="http://localhost/testService/")]
public class Service1 : System.Web.Services.WebService
{
public Service1()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}
#region Component Designer generated code
//Required by the Web Services Designer
private IContainer components = null;
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
}
#endregion
[WebMethod]
public double MathFun(double a,double b)
{
double c;
c= a +b ;
return c;
}
}
}
this is discofile
<?xml version="1.0" ?>
<discovery xmlns="http://schemas.xmlsoap.org/disco/">
<discoveryRef ref="/Folder/Default.disco" />
<contractRef ref="http://waseem-pc/testService/Service1.asmx?WSDL" docRef="Service.htm" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<schemaRef ref="Schema.xsd" xmlns="http://schemas.xmlsoap.org/disco/schema/" />
</discovery>
this is calling code
[WebService(Namespace="http://localhost/testService/")]
Patwar.Check.Service1 srv = new Patwar.Check.Service1(); chk = srv.MathFun(1,3);
open IIS
Expand Web Site-->Default Web Site-->Web Service Virtual Directory
and right click on this folder and click on Directory Security Tab
Click on Authantication and Access Control Edit button
and check enable anonymus access
http://geekswithblogs.net/ranganh/archive/2006/02/21/70212.aspx
Saturday, March 24, 2012
Web service Problem
Labels:
asp,
errorrequest,
faild,
fetch,
generate,
http,
net,
service,
servicessystem,
status,
unaothorisedplzzzzzzz,
web
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment