WebService errors

dazlerd

Well-known member
Joined
Sep 29, 2006
Messages
52
Programming Experience
5-10
Hi

I have some errors with my code and Im sure they are to do with priviledges but i cant find any information out about them.

I have 3 machines. a desktop, a laptop and a server
desktop - runs visual studio 2005 for a vb.net app and a asp.net web service. The web service lives on the server.
laptop - holds the sql express db that the vb.net app connects to
server - holds the sql server 2005 database that the web service talks to.

The client app reads data from the db on laptop and then uses the web service on the server to update the db on the server.

I cant figure out how to debug the webservice code, but more of that later...
If the webservice uses code like
Dim dbg As New System.IO.StreamWriter("C:\Inetpub\wwwroot\CDService\debug.txt", true)
then the client app returns error of:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Access to the path 'C:\Inetpub\wwwroot\CDService\debug.txt' is denied.

If i remove the debug log writing I then get error of:
System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.

So then I thought i better try to debug. I compiled the service code as debug, with <compilation debug="true"> in the web.config file.

Now when i say 'debug' it opens IE with URL localhost:2907/Driver.asmx and list the available web methods. When i click on one and enter the parameter needed, IE opens a new window with this error code:

System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.PermissionSet.Demand()

Can somebody please suggest some ideas of how to make this work? I am suppose to be making changes to the service but need to get it working first. The service was written in vb.net 2003, but ive upgraded to 2005. I can remember debugging in 2003 and it didnt involve browsers opening, it was just like debugging a normal service.

Thanks in advance for any help

Darren
 

dazlerd

Well-known member
Joined
Sep 29, 2006
Messages
52
Programming Experience
5-10
Hi

Ive created the CDService webservice locally on the desktop.

I can interrogate the methods in a browser and i see the XML results.

I removed the existing web reference from my client app and added this desktop local as the web reference. The code no longer errors on the debug.txt line but does still error on the NullReferenceException.
 

dazlerd

Well-known member
Joined
Sep 29, 2006
Messages
52
Programming Experience
5-10
Update.

i havent managed to sort to access denied error yet but i have sorted the other two errors.

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.NullReferenceException: Object reference not set to an instance of an object.
This was caused by the original developer using a string variable when it should have been an integer. When reading a datarow it was using dr.table.columns.item(parameter) and it was freaking out. Worked fine for years in vb.net 2003 but 2005 doesnt like it.

And I can now debug the entire application by placing the webservice project in the same IDE as the application.

So just the user priviledge error to go.....
 
Top Bottom