473,320 Members | 1,936 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,320 software developers and data experts.

problem setting up the security on my test web service

Please note: I have cross posted this from Newsgroup:
microsoft.public.dotnet.framework.aspnet.webservic es
with a few minor changes...

I am having a simple problem setting up the security on my test web
service...

My Web service code is:

Imports System.Web.Services
<System.Web.Services.WebService(Namespace :=
"http://tempuri.org/AddNumbersWebService/AddNumbersWebService")> _
Public Class AddNumbersWebService
Inherits System.Web.Services.WebService

<WebMethod()> _
Public Function AddNumbers( ByVal a1 As Integer, _
ByVal a2 As Integer) As String
Dim lResult As String = (A1+A2).ToString
Return lResult
End Function
End Class

This works fine when I test it using F5...
It fires up a web page where I can test the web service.
But when I try to write a win forms client program...

Private Sub DoIt
Try
TextBox3.Text = "Processing"
Application.DoEvents
Dim lV1 As String = TextBox1.Text
Dim lV2 As String = TextBox2.Text
Dim lV1a As Integer = 0
Dim lV2a As Integer = 0
If IsNumeric( lV1 ) Then lV1a = Int( lV1 )
If IsNumeric( lV2 ) Then lV2a = Int( lV2 )
Dim lWebService As New
WebServiceClient.localhost.AddNumbersWebService
Dim lResult As String = lWebService.AddNumbers(lV1a,lV2a)
TextBox3.Text = lResult
Catch ex As Exception
TextBox3.Text = ex.Message
End Try
End Sub

I get the error "The request failed with HTTP status 401: Access
Denied." from the line:
Dim lResult As String = lWebService.AddNumbers(lV1a,lV2a)

I think this is a simple setup problem with the IIS security settings
but I cannot figure it out. Any help would be appreciated.

The environment is:
Running on local host.
VB2003.
MS Windows-XP (SP1)
For the web service:
- anonymous access is allowed.
- Execute permissions = Scripts and executables
- Application protection = Low

Thanks in advance for your help
Greg

p.s. the reference.vb file contains...
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'This source code was auto-generated by Microsoft.VSDesigner, Version
1.1.4322.573.
'
Namespace localhost1

'<remarks/>
<System.Diagnostics.DebuggerStepThroughAttribute() , _
System.ComponentModel.DesignerCategoryAttribute("c ode"), _
System.Web.Services.WebServiceBindingAttribute(Nam e:="AddNumbersWebServiceSoap",
[Namespace]:="http://tempuri.org/AddNumbersWebService/AddNumbersWebService")>
_
Public Class AddNumbersWebService
Inherits System.Web.Services.Protocols.SoapHttpClientProtoc ol

'<remarks/>
Public Sub New()
MyBase.New
Me.Url =
"http://localhost/AddNumbersWebService/AddNumbersWebService.asmx"
End Sub

'<remarks/>
<System.Web.Services.Protocols.SoapDocumentMethodA ttribute("http://tempuri.org/AddNumbersWebService/AddNumbersWebService/AddNumbers",
RequestNamespace:="http://tempuri.org/AddNumbersWebService/AddNumbersWebService",
ResponseNamespace:="http://tempuri.org/AddNumbersWebService/AddNumbersWebService",
Use:=System.Web.Services.Description.SoapBindingUs e.Literal,
ParameterStyle:=System.Web.Services.Protocols.Soap ParameterStyle.Wrapped)>
_
Public Function AddNumbers(ByVal a1 As Integer, ByVal a2 As
Integer) As String
Dim results() As Object = Me.Invoke("AddNumbers", New
Object() {a1, a2})
Return CType(results(0),String)
End Function

'<remarks/>
Public Function BeginAddNumbers(ByVal a1 As Integer, ByVal a2
As Integer, ByVal callback As System.AsyncCallback, ByVal asyncState
As Object) As System.IAsyncResult
Return Me.BeginInvoke("AddNumbers", New Object() {a1, a2},
callback, asyncState)
End Function

'<remarks/>
Public Function EndAddNumbers(ByVal asyncResult As
System.IAsyncResult) As String
Dim results() As Object = Me.EndInvoke(asyncResult)
Return CType(results(0),String)
End Function
End Class
End Namespace
Nov 23 '05 #1
2 1740
Hi Greg,

You must allow anonymous access to your virtual directory in IIS management console.

Regards,

Martin Kulov
http://www.codeattest.com

MCAD Charter Member
MCSD.NET Early Achiever
MCSD
Nov 23 '05 #2
Grey wrote:
The environment is:
Running on local host.
VB2003.
MS Windows-XP (SP1)
For the web service:
- anonymous access is allowed.
- Execute permissions = Scripts and executables
- Application protection = Low
Greg, even though you have said that 'anonymous access is allowed', Martin's
answer holds good. If you check closely, I suspect both the anonymous access
and the integrated windows authentication checkboxes will be checked.
Uncheck the integrated windows authentication checkbox and your web service
will become usable by Windows Forms applications.

Mujtaba.

"Martin Kulov" <ku***@bezbokluk.abv.bg> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl... Hi Greg,

You must allow anonymous access to your virtual directory in IIS management console.
Regards,

Martin Kulov
http://www.codeattest.com

MCAD Charter Member
MCSD.NET Early Achiever
MCSD

Nov 23 '05 #3

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

Similar topics

2
by: Joseph Geretz | last post by:
I'm having a credentialing problem in my web application. Actually, I don't think this is an IIS security issue, since I'm able to access the page I'm requesting. However, the executing page itself...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
4
by: Jeff B | last post by:
I am having a very perplexing problem with setting the user's roles. I have tried to figure this out for 2 days now. When the user logs in to the site, I retrieve the roles from the database and...
15
by: Ron L | last post by:
We are working on a distributed VB.Net application which will access a SQL database located on a known server. Each client will run on the user's local machine. To implement this, we are trying...
5
by: Segfahlt | last post by:
I need a little help here please. I have 2 win forms user controls in 2 different projects that I'm hosting in 2 different virtual directories. The controls have been test and operate okay in...
3
by: clsmith66 | last post by:
I hope this is just something stupid I'm missing and someone can easily point out my error. I'm trying to do a few turorials on windows services, and the couple I found so far just create an event...
2
by: Jeff | last post by:
Hey asp.net 2.0 My asp.net 2.0 project has got a assembly load problem: Some of my web.config settings: <membership defaultProvider="AH_MembershipProvider" userIsOnlineTimeWindow="15">
1
by: eblackmo | last post by:
I have a test network consisting of four servers running windows 2003 server R2 SP2. I have set up a domain which functioned correctly for about a day and a half until the other servers decided they...
0
by: krystian | last post by:
Hello, I've been following the previous thread "Windows Service Starts and Immediately Stops" and I have a similar problem. I've been trying to get started on a windows service and have...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.