Possible IIS Installation Issue

nodavies

Member
Joined
Jun 3, 2005
Messages
6
Location
New Orleans
Programming Experience
10+
Hi,

I've recently installed VS.NET and am having problems with the usage of a certain type of Web Service when running against IIS 5.0.

It seems that basic 'Hello World' type services work in the browser without any problems, but when I create a Web Service with data that is pulled from a SQL Server database I receive an error once I 'Invoke' the HTTP GET - I receive a HTTP 500 error along with 'The page cannot be displayed'.

Any support on this issue will be warmly received.

Thanks, Mark
 
The code in question...

Thanks for the reply LevyUK - this is the code, hopefully it will provide a little more insight...


Imports System.Web.Services
Imports System.Data.OleDb

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

<WebMethod()> _
Public Function ListCustomers() As DataSet
Dim myConnection As OleDbConnection
Dim myDataAdapter As OleDbDataAdapter
Dim myDataSet As DataSet

myConnection = New OleDbConnection _
("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False; Initial Catalog=Northwind;Data Source=TEST\TEST;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=TEST1;Use Encryption for Data=False;Tag with column collation when possible=False")
myDataAdapter = New OleDbDataAdapter("SELECT * FROM customers", myConnection)
myDataSet = New DataSet()
myDataAdapter.Fill(myDataSet, "Customers")
Return myDataSet

End Function
End Class
 
Ok I had to change it a little bit. First I changed it to use sql instead of oledb. That is simply because i use an sql database. You dont need to worry about that though. Or the connection string which i also changed. Try this

VB.NET:
[size=2][color=#0000ff]Imports[/color][/size][size=2] System.Web.Services

[/size][size=2][color=#0000ff]Imports[/color][/size][size=2] System.Data.OLedb

[/size][size=2][color=#0000ff]Imports[/color][/size][size=2] System.Data

<WebService(Namespace:=[/size][size=2][color=#800000]"http://tempuri.org/"[/color][/size][size=2])> [/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Class[/color][/size][size=2] WebService

[/size][size=2][color=#0000ff]Inherits[/color][/size][size=2] System.Web.Services.WebService

<WebMethod()> _

[/size][size=2][color=#0000ff]Public[/color][/size][size=2] [/size][size=2][color=#0000ff]Function[/color][/size][size=2] ListCustomers() [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataSet
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myConnection [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbConnection
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myDataAdapter [/size][size=2][color=#0000ff]As[/color][/size][size=2] OleDbDataAdapter
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myDataSet [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataSet
myConnection = [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbConnection _
([/size][size=2][color=#800000]"Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False; Initial Catalog=Northwind;Data Source=TEST\TEST;Use Procedure for Prepare=1;Auto [/color][/size]
[size=2][color=#800000]Translate=True;Packet Size=4096;Workstation ID=TEST1;Use Encryption for Data=False;Tag with column collation when possible=False"[/color][/size][size=2])
myDataAdapter = [/size][size=2][color=#0000ff]New[/color][/size][size=2] OleDbDataAdapter([/size][size=2][color=#800000]"SELECT * FROM customer"[/color][/size][size=2], myConnection)[/size]
[size=2]myDataSet = [/size][size=2][color=#0000ff]New[/color][/size][size=2] DataSet()
myDataAdapter.Fill(myDataSet, [/size][size=2][color=#800000]"Customer"[/color][/size][size=2])
[/size][size=2][color=#0000ff]Return[/color][/size][size=2] myDataSet
[/size][size=2][color=#0000ff]End[/color][/size][size=2] [/size][size=2][color=#0000ff]Function
End[/color][/size][size=2] [/size][size=2][color=#0000ff]Class
[/color][/size]

And if you wanted to bind it to a grid for example use this code
VB.NET:
[size=2][color=#0000ff]Dim[/color][/size][size=2] Webservice [/size][size=2][color=#0000ff]As[/color][/size][size=2] [/size][size=2][color=#0000ff]New[/color][/size][size=2] WebService
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].GridView1.DataSource = Webservice.ListCustomers
[/size][size=2][color=#0000ff]Me[/color][/size][size=2].GridView1.DataBind()
[/size]
Hope that helps
 
Unfortunately Not

Thanks for the try though - I really think it's something to do with the way I have rights [maybe] set up on IIS.

The fact that the build looks good and that I'm not throwing an error anywhere leads me to believe that for some reason i don't have the correct "access" for displaying the appropriate response once

http://localhost/AnotherTest/AnotherTest.asmx/ListCustomers?

is issued...

Let me know if you have any more ideas!
 
Ok, something new...

Ok, I've got a little further. I unchecked 'Show friendly HTTP error messages' in IE and I received this message...

Login failed for user TEST1\ASPNET

I figure that somehow there is a ASPNET user that I need to add to a group somewhere to provide access to the SQL database - but I can't find where...

Any help please?
 
Thanks Levy - you must live 24/7 on this forum!

As with all learning curves I finally figured out what was going on - I used Enterprise Manager to go to the Northwind Database and used the User icon to create a user account for machinename\ASPNET. I ran the Web Service again and it ran without a problem.

Thanks again!
 
Back
Top