473,324 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Web Service throws 401 Error when consumed

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

Nov 18 '05 #1
4 2904
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" <sa****@hp.com> wrote in message
news:3f********@usenet01.boi.hp.com...
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

Nov 18 '05 #2
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:%2******************@TK2MSFTNGP11.phx.gbl...
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" <sa****@hp.com> wrote in message
news:3f********@usenet01.boi.hp.com...
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


Nov 18 '05 #3
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" <sa****@hp.com> wrote in message
news:3f******@usenet01.boi.hp.com...
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:%2******************@TK2MSFTNGP11.phx.gbl...
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" <sa****@hp.com> wrote in message
news:3f********@usenet01.boi.hp.com...
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



Nov 18 '05 #4
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:%2****************@TK2MSFTNGP11.phx.gbl...
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" <sa****@hp.com> wrote in message
news:3f******@usenet01.boi.hp.com...
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:%2******************@TK2MSFTNGP11.phx.gbl...
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" <sa****@hp.com> wrote in message
news:3f********@usenet01.boi.hp.com...
> 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
>
>
>



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Zeya | last post by:
I have this code, which uses WMI to operate on Windows service from C# code. When Service.InvokeMethod is called, the method throws an exception: System.Management Operation is not valid due...
1
by: Sunil Sabir | last post by:
Dear All, I have written a Web Service which is called from ASPX file(Web Form). It works fine on the local machine. On the local machine I am using the following command wsdl.exe /l:cs...
0
by: Barb | last post by:
Hello, I have a (C#) web service being consumed by a high volume "asp classic" site. It worked perfectly until I tried consuming a second web service from the first web service. Both services...
4
by: ian | last post by:
Hi, I have a really simple web service public class MyService : System.Web.Services.WebService { public double DoWork (string pFunction ) { return IDoTheWork.GetInstance().DoWork(pFunction);...
7
by: shai | last post by:
I am working at .net 1.1, writing in c#. I have windows service with a COM object. Every unexpected time The COM object throw an error that make my service get stuck (do not respond). I can catch...
15
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 ...
3
by: Jeremy Chapman | last post by:
I've writtin a very simple web service in axis which returns an array of classes. I consume it in a .net app. When receiving the response, my .net app generates an error "Cannot assign object...
0
by: ArunkumarSundaravelu | last post by:
Hi I’m creating one windows service in my own purpose Using msxml4.dll. The process of service is to fetch the data from exchange server through webdav SEARCH METHOD When i use this coding...
3
by: =?Utf-8?B?R3JlZw==?= | last post by:
I have just created a WCF service that is using WShttpbasic and all is good when another .net 3.0 application consumes it. However, I have legacy apps that must use this service and are running on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.