473,563 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem setting up the security on my test web service

Please note: I have cross posted this from Newsgroup:
microsoft.publi c.dotnet.framew ork.aspnet.webs ervices
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.Serv ices
<System.Web.Ser vices.WebServic e(Namespace :=
"http://tempuri.org/AddNumbersWebSe rvice/AddNumbersWebSe rvice")> _
Public Class AddNumbersWebSe rvice
Inherits System.Web.Serv ices.WebService

<WebMethod()> _
Public Function AddNumbers( ByVal a1 As Integer, _
ByVal a2 As Integer) As String
Dim lResult As String = (A1+A2).ToStrin g
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.DoE vents
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
WebServiceClien t.localhost.Add NumbersWebServi ce
Dim lResult As String = lWebService.Add Numbers(lV1a,lV 2a)
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.Add Numbers(lV1a,lV 2a)

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.Componen tModel
Imports System.Diagnost ics
Imports System.Web.Serv ices
Imports System.Web.Serv ices.Protocols
Imports System.Xml.Seri alization

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

'<remarks/>
<System.Diagnos tics.DebuggerSt epThroughAttrib ute(), _
System.Componen tModel.Designer CategoryAttribu te("code"), _
System.Web.Serv ices.WebService BindingAttribut e(Name:="AddNum bersWebServiceS oap",
[Namespace]:="http://tempuri.org/AddNumbersWebSe rvice/AddNumbersWebSe rvice")>
_
Public Class AddNumbersWebSe rvice
Inherits System.Web.Serv ices.Protocols. SoapHttpClientP rotocol

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

'<remarks/>
<System.Web.Ser vices.Protocols .SoapDocumentMe thodAttribute(" http://tempuri.org/AddNumbersWebSe rvice/AddNumbersWebSe rvice/AddNumbers",
RequestNamespac e:="http://tempuri.org/AddNumbersWebSe rvice/AddNumbersWebSe rvice",
ResponseNamespa ce:="http://tempuri.org/AddNumbersWebSe rvice/AddNumbersWebSe rvice",
Use:=System.Web .Services.Descr iption.SoapBind ingUse.Literal,
ParameterStyle: =System.Web.Ser vices.Protocols .SoapParameterS tyle.Wrapped)>
_
Public Function AddNumbers(ByVa l a1 As Integer, ByVal a2 As
Integer) As String
Dim results() As Object = Me.Invoke("AddN umbers", 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.AsyncCal lback, ByVal asyncState
As Object) As System.IAsyncRe sult
Return Me.BeginInvoke( "AddNumbers ", New Object() {a1, a2},
callback, asyncState)
End Function

'<remarks/>
Public Function EndAddNumbers(B yVal asyncResult As
System.IAsyncRe sult) As String
Dim results() As Object = Me.EndInvoke(as yncResult)
Return CType(results(0 ),String)
End Function
End Class
End Namespace
Nov 23 '05 #1
2 1758
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***@bezboklu k.abv.bg> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l... 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
2614
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 is not able to access a specific network resource and I just can't figure out why. First of all, let me say this worked fine with IIS running on...
1
4739
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 I have run into I am not sure how to fix, and really not sure what is causing it. Here's what is going on (test server - Windows 2003 Server): I...
4
1924
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 create a semicolon delimited string listing the roles returned and store them in the forms authentication cookie. Then in the global.asax...
15
2387
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 to use remoting for our access to the SQL server, with the remoting being via IIS. Since all of our users will have accounts in the destination...
5
4067
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 both projects. Both controls(dlls) have been signed using SN.exe and I've set up the appropriate .Net assembly permissions using those Strong Names...
3
1391
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 log and write an entry on start and stop. I build the projects and install them fine, but when I run the service it starts and stops instantly. ...
2
3369
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
15205
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 can no longer connect to the domain controller. Ping resolves the domain controllers name to the correct ip nslookup finds the ip but can not resolve...
0
1139
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 followed the following rather well known tutorial (I also make some references to it in this writeup):
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7882
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5208
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3634
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...

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.