Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Web Service throws 401 Error when consumed

Reply
Thread Tools

Web Service throws 401 Error when consumed

 
 
Sanjay
Guest
Posts: n/a
 
      11-18-2003
I have written a web service to return information from the database. This
works and the data is returned in XML format from the database and displayed
on the web page as well when this web service called getsampledata is
invoked. Now I create a web page and created a webservice using the web
reference technique in the VS .NET to consume this web service. The web
page (application), web server, web service and database are on the same
box. Here is where my problems start. I keep getting this error message
reproduced here.

System.Net.WebException: The request failed with HTTP status 401: Access
Denied. at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
Message message, WebResponse response, Stream responseStream, Boolean
asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters) at
WebPageWebServiceTest.HPSD.Service1.GetSampleData( ) in
C:\Inetpub\wwwroot\WebPageWebServiceTest\Web
References\HPSD\Reference.cs:line 40 at
WebPageWebServiceTest.WebForm1.Button1_Click(Objec t sender, EventArgs e) in
c:\inetpub\wwwroot\webpagewebservicetest\webform1. aspx.cs:line 69

Name of the web page trying to consume the webservice =
WebPageWebServiceTest
Name of the webservice HPSD.Service1.GetSampleData().


I have played around with the web config file and have the following working
web.conifg parameters
<authentication mode="None" />

<identity impersonate="true" />

Same parameters on both the web.config files ie on the web service and web
page(application). The database has aspnet configured as a user. The
following line is the connection string details on the webservice

sqlConnectionString="Provider=SQLOLEDB.1;integrate dsecurity=SSPI;Persist
Security Info=False;Initial Catalog=XXX_DEV;Data Source=XXXX;

I just am not able to get past the error noted above.

I am wondering if anyone else has run into this problem. Any pointers/tips
much appreciated.

Thanks

Sanjay



 
Reply With Quote
 
 
 
 
Chris Jackson
Guest
Posts: n/a
 
      11-18-2003
Do you have anonymous access turned on for your web application? Here is a
knowledge base article that addresses this situation and may help:

http://support.microsoft.com/default...b;en-us;811318


--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Sanjay" <> wrote in message
news:3fb96917$...
> I have written a web service to return information from the database. This
> works and the data is returned in XML format from the database and

displayed
> on the web page as well when this web service called getsampledata is
> invoked. Now I create a web page and created a webservice using the web
> reference technique in the VS .NET to consume this web service. The web
> page (application), web server, web service and database are on the same
> box. Here is where my problems start. I keep getting this error message
> reproduced here.
>
> System.Net.WebException: The request failed with HTTP status 401: Access
> Denied. at
>

System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
> Message message, WebResponse response, Stream responseStream, Boolean
> asyncCall) at
> System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
> methodName, Object[] parameters) at
> WebPageWebServiceTest.HPSD.Service1.GetSampleData( ) in
> C:\Inetpub\wwwroot\WebPageWebServiceTest\Web
> References\HPSD\Reference.cs:line 40 at
> WebPageWebServiceTest.WebForm1.Button1_Click(Objec t sender, EventArgs e)

in
> c:\inetpub\wwwroot\webpagewebservicetest\webform1. aspx.cs:line 69
>
> Name of the web page trying to consume the webservice =
> WebPageWebServiceTest
> Name of the webservice HPSD.Service1.GetSampleData().
>
>
> I have played around with the web config file and have the following

working
> web.conifg parameters
> <authentication mode="None" />
>
> <identity impersonate="true" />
>
> Same parameters on both the web.config files ie on the web service and

web
> page(application). The database has aspnet configured as a user. The
> following line is the connection string details on the webservice
>
> sqlConnectionString="Provider=SQLOLEDB.1;integrate dsecurity=SSPI;Persist
> Security Info=False;Initial Catalog=XXX_DEV;Data Source=XXXX;
>
> I just am not able to get past the error noted above.
>
> I am wondering if anyone else has run into this problem. Any

pointers/tips
> much appreciated.
>
> Thanks
>
> Sanjay
>
>
>



 
Reply With Quote
 
 
 
 
Sanjay
Guest
Posts: n/a
 
      11-18-2003
Thank you Chris
That took care of that problem. Really apprecate your help.
Now to figure out how to get the xml data out of the dataset and bind to the
datagrid.
Thanks again.
Sanjay

"Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
news:%23R%...
> Do you have anonymous access turned on for your web application? Here is a
> knowledge base article that addresses this situation and may help:
>
> http://support.microsoft.com/default...b;en-us;811318
>
>
> --
> Chris Jackson
> Software Engineer
> Microsoft MVP - Windows Shell/UI
> Windows XP Associate Expert
> --
> More people read the newsgroups than read my email.
> Reply to the newsgroup for a faster response.
> (Control-G using Outlook Express)
> --
>
> "Sanjay" <> wrote in message
> news:3fb96917$...
> > I have written a web service to return information from the database.

This
> > works and the data is returned in XML format from the database and

> displayed
> > on the web page as well when this web service called getsampledata is
> > invoked. Now I create a web page and created a webservice using the

web
> > reference technique in the VS .NET to consume this web service. The

web
> > page (application), web server, web service and database are on the

same
> > box. Here is where my problems start. I keep getting this error message
> > reproduced here.
> >
> > System.Net.WebException: The request failed with HTTP status 401:

Access
> > Denied. at
> >

>

System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
> > Message message, WebResponse response, Stream responseStream, Boolean
> > asyncCall) at
> > System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
> > methodName, Object[] parameters) at
> > WebPageWebServiceTest.HPSD.Service1.GetSampleData( ) in
> > C:\Inetpub\wwwroot\WebPageWebServiceTest\Web
> > References\HPSD\Reference.cs:line 40 at
> > WebPageWebServiceTest.WebForm1.Button1_Click(Objec t sender, EventArgs e)

> in
> > c:\inetpub\wwwroot\webpagewebservicetest\webform1. aspx.cs:line 69
> >
> > Name of the web page trying to consume the webservice =
> > WebPageWebServiceTest
> > Name of the webservice HPSD.Service1.GetSampleData().
> >
> >
> > I have played around with the web config file and have the following

> working
> > web.conifg parameters
> > <authentication mode="None" />
> >
> > <identity impersonate="true" />
> >
> > Same parameters on both the web.config files ie on the web service and

> web
> > page(application). The database has aspnet configured as a user. The
> > following line is the connection string details on the webservice
> >
> > sqlConnectionString="Provider=SQLOLEDB.1;integrate dsecurity=SSPI;Persist
> > Security Info=False;Initial Catalog=XXX_DEV;Data Source=XXXX;
> >
> > I just am not able to get past the error noted above.
> >
> > I am wondering if anyone else has run into this problem. Any

> pointers/tips
> > much appreciated.
> >
> > Thanks
> >
> > Sanjay
> >
> >
> >

>
>



 
Reply With Quote
 
Chris Jackson
Guest
Posts: n/a
 
      11-19-2003
You can bind to any class that supports the IEnumerable interface:

dataGrid.DataSource = dataSet;
dataGrid.DataBind();

--
Chris Jackson
Software Engineer
Microsoft MVP - Windows Shell/UI
Windows XP Associate Expert
--
More people read the newsgroups than read my email.
Reply to the newsgroup for a faster response.
(Control-G using Outlook Express)
--

"Sanjay" <> wrote in message
news:...
> Thank you Chris
> That took care of that problem. Really apprecate your help.
> Now to figure out how to get the xml data out of the dataset and bind to

the
> datagrid.
> Thanks again.
> Sanjay
>
> "Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
> news:%23R%...
> > Do you have anonymous access turned on for your web application? Here is

a
> > knowledge base article that addresses this situation and may help:
> >
> > http://support.microsoft.com/default...b;en-us;811318
> >
> >
> > --
> > Chris Jackson
> > Software Engineer
> > Microsoft MVP - Windows Shell/UI
> > Windows XP Associate Expert
> > --
> > More people read the newsgroups than read my email.
> > Reply to the newsgroup for a faster response.
> > (Control-G using Outlook Express)
> > --
> >
> > "Sanjay" <> wrote in message
> > news:3fb96917$...
> > > I have written a web service to return information from the database.

> This
> > > works and the data is returned in XML format from the database and

> > displayed
> > > on the web page as well when this web service called getsampledata is
> > > invoked. Now I create a web page and created a webservice using the

> web
> > > reference technique in the VS .NET to consume this web service. The

> web
> > > page (application), web server, web service and database are on the

> same
> > > box. Here is where my problems start. I keep getting this error

message
> > > reproduced here.
> > >
> > > System.Net.WebException: The request failed with HTTP status 401:

> Access
> > > Denied. at
> > >

> >

>

System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
> > > Message message, WebResponse response, Stream responseStream, Boolean
> > > asyncCall) at
> > > System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
> > > methodName, Object[] parameters) at
> > > WebPageWebServiceTest.HPSD.Service1.GetSampleData( ) in
> > > C:\Inetpub\wwwroot\WebPageWebServiceTest\Web
> > > References\HPSD\Reference.cs:line 40 at
> > > WebPageWebServiceTest.WebForm1.Button1_Click(Objec t sender, EventArgs

e)
> > in
> > > c:\inetpub\wwwroot\webpagewebservicetest\webform1. aspx.cs:line 69
> > >
> > > Name of the web page trying to consume the webservice =
> > > WebPageWebServiceTest
> > > Name of the webservice HPSD.Service1.GetSampleData().
> > >
> > >
> > > I have played around with the web config file and have the following

> > working
> > > web.conifg parameters
> > > <authentication mode="None" />
> > >
> > > <identity impersonate="true" />
> > >
> > > Same parameters on both the web.config files ie on the web service

and
> > web
> > > page(application). The database has aspnet configured as a user. The
> > > following line is the connection string details on the webservice
> > >
> > >

sqlConnectionString="Provider=SQLOLEDB.1;integrate dsecurity=SSPI;Persist
> > > Security Info=False;Initial Catalog=XXX_DEV;Data Source=XXXX;
> > >
> > > I just am not able to get past the error noted above.
> > >
> > > I am wondering if anyone else has run into this problem. Any

> > pointers/tips
> > > much appreciated.
> > >
> > > Thanks
> > >
> > > Sanjay
> > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Sanjay
Guest
Posts: n/a
 
      11-20-2003
Actually Chris I knew that and the web service is working now like a charm.
But thanks for the reply anyway.
Sanjay

PS I have a new question posted on this newsgroup which might 'ahem'
require your expertise/attention.


"Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
news:%...
> You can bind to any class that supports the IEnumerable interface:
>
> dataGrid.DataSource = dataSet;
> dataGrid.DataBind();
>
> --
> Chris Jackson
> Software Engineer
> Microsoft MVP - Windows Shell/UI
> Windows XP Associate Expert
> --
> More people read the newsgroups than read my email.
> Reply to the newsgroup for a faster response.
> (Control-G using Outlook Express)
> --
>
> "Sanjay" <> wrote in message
> news:...
> > Thank you Chris
> > That took care of that problem. Really apprecate your help.
> > Now to figure out how to get the xml data out of the dataset and bind to

> the
> > datagrid.
> > Thanks again.
> > Sanjay
> >
> > "Chris Jackson" <chrisjATmvpsDOTorgNOSPAM> wrote in message
> > news:%23R%...
> > > Do you have anonymous access turned on for your web application? Here

is
> a
> > > knowledge base article that addresses this situation and may help:
> > >
> > > http://support.microsoft.com/default...b;en-us;811318
> > >
> > >
> > > --
> > > Chris Jackson
> > > Software Engineer
> > > Microsoft MVP - Windows Shell/UI
> > > Windows XP Associate Expert
> > > --
> > > More people read the newsgroups than read my email.
> > > Reply to the newsgroup for a faster response.
> > > (Control-G using Outlook Express)
> > > --
> > >
> > > "Sanjay" <> wrote in message
> > > news:3fb96917$...
> > > > I have written a web service to return information from the

database.
> > This
> > > > works and the data is returned in XML format from the database and
> > > displayed
> > > > on the web page as well when this web service called getsampledata

is
> > > > invoked. Now I create a web page and created a webservice using

the
> > web
> > > > reference technique in the VS .NET to consume this web service.

The
> > web
> > > > page (application), web server, web service and database are on the

> > same
> > > > box. Here is where my problems start. I keep getting this error

> message
> > > > reproduced here.
> > > >
> > > > System.Net.WebException: The request failed with HTTP status 401:

> > Access
> > > > Denied. at
> > > >
> > >

> >

>

System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
> > > > Message message, WebResponse response, Stream responseStream,

Boolean
> > > > asyncCall) at
> > > > System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
> > > > methodName, Object[] parameters) at
> > > > WebPageWebServiceTest.HPSD.Service1.GetSampleData( ) in
> > > > C:\Inetpub\wwwroot\WebPageWebServiceTest\Web
> > > > References\HPSD\Reference.cs:line 40 at
> > > > WebPageWebServiceTest.WebForm1.Button1_Click(Objec t sender,

EventArgs
> e)
> > > in
> > > > c:\inetpub\wwwroot\webpagewebservicetest\webform1. aspx.cs:line 69
> > > >
> > > > Name of the web page trying to consume the webservice =
> > > > WebPageWebServiceTest
> > > > Name of the webservice HPSD.Service1.GetSampleData().
> > > >
> > > >
> > > > I have played around with the web config file and have the following
> > > working
> > > > web.conifg parameters
> > > > <authentication mode="None" />
> > > >
> > > > <identity impersonate="true" />
> > > >
> > > > Same parameters on both the web.config files ie on the web service

> and
> > > web
> > > > page(application). The database has aspnet configured as a user. The
> > > > following line is the connection string details on the webservice
> > > >
> > > >

> sqlConnectionString="Provider=SQLOLEDB.1;integrate dsecurity=SSPI;Persist
> > > > Security Info=False;Initial Catalog=XXX_DEV;Data Source=XXXX;
> > > >
> > > > I just am not able to get past the error noted above.
> > > >
> > > > I am wondering if anyone else has run into this problem. Any
> > > pointers/tips
> > > > much appreciated.
> > > >
> > > > Thanks
> > > >
> > > > Sanjay
> > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Am I right in a way to measure CPU time consumed by a block of code? www Java 1 04-05-2007 10:01 PM
Am I right in a way to measure CPU time consumed by a block of code? www Java 0 04-05-2007 08:40 PM
finding how much time that is consumed? raybakk@yahoo.no C Programming 5 08-20-2006 07:46 PM
Winupdate consumed most of my free space hregev@yahoo.com Computer Support 2 11-17-2005 01:43 AM
Nachi-A worm consumed all of router's memory? duder Cisco 1 12-12-2003 08:40 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57