• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 837
  • Last Modified:

Web service method call yields a Soap exception

Hello all,

We have written a .net (c#) web service with several methods. A call to one of the methods from an external application (also written in c#.net) seemed to not be preocessed by the web service. We then, added fairly tight event logging to the web service, logging almost every line. The method itself creates an instance of an object with a default constructor. We have logging inside the method, before the object creation, after the object creation and inside the constructor itself. The only log message we were seeing was the one before the object creation. The code just seems to stop/disappear.

Totally baffled, we created a side small test application which only made that single call to the method in question. The error that was thrown up in our faces (from the JIT debugger) is listed below (sorry this is so long):

//-----------------------------------------------------------------------------------------------------------------------------------//
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Security.SecurityException: Requested registry access is not allowed.
   at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
   at System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName, Boolean useMutex)
   at System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID)
   at System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type)
   at IMK.AE.WS.IMK_AE_WS.SetKioskStatus(Int32 kioskID, MessagePriority Priority, XmlDocument xmlMessage) in c:\develop.net\web solutions\iae\imk_ae_ws\imk_ae_ws.asmx.cs:line 109
   --- End of inner exception stack trace ---
   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
   at AandPQuickTest.localhost.IMK_AE_WS.SetKioskStatus(Int32 kioskID, MessagePriority Priority, XmlNode xmlMessage) in C:\AandPQuickTest\Web References\localhost\Reference.cs:line 37
   at AandPQuickTest.Form1.button1_Click(Object sender, EventArgs e) in c:\aandpquicktest\form1.cs:line 136
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
AandPQuickTest
    Assembly Version: 1.0.2321.22726
    Win32 Version: 1.0.2321.22726
    CodeBase: file:///C:/_Intermedia%20Updates/AandPQuickTest.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Drawing
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
System.Web.Services
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system.web.services/1.0.5000.0__b03f5f7f11d50a3a/system.web.services.dll
----------------------------------------
System.Xml
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------
fbuc_8z4
    Assembly Version: 0.0.0.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
System.Web
    Assembly Version: 1.0.5000.0
    Win32 Version: 1.1.4322.2300
    CodeBase: file:///c:/windows/assembly/gac/system.web/1.0.5000.0__b03f5f7f11d50a3a/system.web.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.

//-----------------------------------------------------------------------------------------------------------------------------------//

Also, to keep in mind: This works fine on our development machine (windows xp pro), but not on the client's machine (windows server 2003 R2) .  {isn't that always the case: "it works on my machine...."  lol}

I jest, but this is a serious project which is already at the client's site, and we have already lost 3 days trying to figure this one out.  

Any help would be appreciated.
0
imkiosks
Asked:
imkiosks
  • 3
  • 2
1 Solution
 
mrichmonCommented:
It looks like of course it works on your machine because you have permissions.  The core message is that you do not have access to a registry value you are trying to get access to.  I would guess that it is a good thing that it is failing (well from a security point of view - not necesarily yours) since you are getting a security exception.

I am betting permissions are different on thier machine - and that the difference is better security
0
 
imkiosksAuthor Commented:
mrichmon,

Without a doubt, the issue is security and access privileges - but which?? We have tried different approaches of adding ASP.net to the admin group, setting permissions on the web service in IIS, etc., but to no avail.
0
 
mrichmonCommented:
What registry settings are you trying to access?  WHY are you having your application access/modify registry settings?  That is what needs to be examined to determine what security issue is causing this.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
imkiosksAuthor Commented:
We have discovered that there was another instance of a slightly older DLL (which is being used by the web service. We think that the method call to the web service was working fine, but the CLR was getting confused as to which DLL to go to after the method call. To solve this, we simply reated a new dll with a different name. We needed to clean up some other things as well - so this was a good opportunity to create the new dll. Everything worked fine at that point.

The web service was NOT trying to access the registry. I think what was happening is that an attempt to log a message to the event log forced a check against the registry to make sure the web service was allowed to write to the event log. That's the part that blew up - the registry entry apperantly was not there.

We still have not completely figured out what the solution would have been to the original problem. Oh well, can't win 'em all........
0
 
mrichmonCommented:
It was trying to access the registry.  Notice that the registry entry not being there caused the crash.  It couldn't know that without accessing the registry.

But I am glad you have it working for now.
0
 
GranModCommented:
PAQed with points refunded (500)

GranMod
Community Support Moderator
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now