[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Web service method call yields a Soap exception

Posted on 2006-05-10
8
Medium Priority
?
814 Views
Last Modified: 2008-01-09
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
Comment
Question by:imkiosks
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 16653261
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
 

Author Comment

by:imkiosks
ID: 16658294
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
 
LVL 35

Expert Comment

by:mrichmon
ID: 16659540
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:imkiosks
ID: 16699623
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
 
LVL 35

Expert Comment

by:mrichmon
ID: 16700018
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
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16982169
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question