Link to home
Start Free TrialLog in
Avatar of DotNet_Dev
DotNet_Dev

asked on

WS fails to work when deployed on IIS due to 'modal dialog box' error message

Hi,
I have a .Net Web Service that has been deployed to IIS server.  When I try to call the WS from the browser (IE), I’ll get the following error message.
"Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation.Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application"
This WS has a reference to a PowerBuilder dll (which was created in PowerBuilder then deployed to .net) that will get the database credentials for my WS.  
Not sure if this is caused due to .Net framework compatibilities as this WS will work when I run it using ‘Visual Studio Development Server’ within VS 2010 (not on IIS),  but fails to work when it is deployed to IIS.
I have tried placing the below code into the web.config file and it did not help.
<startup useLegacyV2RuntimeActivationPolicy="true">              
     <supportedRuntime version="v4.0" />    
</startup>
One thing I should note is that this error is coming from the dll which was built using .net v2.0 framework (web service works on IIS without the dll).  The dll does not have any reference to a messagebox or any output window.
The program fails when it try to consume the dll with the error message shown below.  As it’s being a dll I have no idea on how to debug this problem.
Is there any property that I can set on web.config or any other place that will tell the IIS  to ignore any popup’s/alert windows while running on the server?
Any help would be greatly appreciated.
Thank you!
Avatar of khairil
khairil
Flag of Malaysia image

Hi,

May be your PB dll is prompting a form for credential.

You can test this out, create a .Net WINDOWS FORM application and called the same procedure at the server side to get if any prompt or dialog present to you. Call the PB dll directly, not via the WS.

If it is the PB problem then you must fix the PB dll, nothing in web.config can help you on this.
I hope I have understood your issue correctly. Your dll is trying to show a Messagebox or some other kind of UI. How did you checked that "The dll does not have any reference to a messagebox or any output window."?

I doubt if it possible to configure IIS to allow it show a Form. As you might agree, this is certainly an issue due to bad design of the dll. A server-side component should not be showing messagebox or any other UI that blocks component's execution.

Only bad way I can think of is to "exactly" figure out in what kind of situation(s) the dll trys to show a messagebox and take all necessary steps to prevent such condition altogether.

Otherwise, it would be best if you can remove such message-box from source code and rebuild the same dll. Because even if you will find a way to make it working on IIS now, imagine what will happen if during production usage of your app if a messagebox will pop-up and no one is sitting in-front of the server to close it!
Avatar of DotNet_Dev
DotNet_Dev

ASKER

Sorry for the late response!

You can test this out, create a .Net WINDOWS FORM application and called the same procedure at the server side to get if any prompt or dialog present to you. Call the PB dll directly, not via the WS.

Initially we tried testing the dll from a windows form and a console app, and are sure there is no message box in the code or any kind of prompting going on, as my colleague wrote the powerbuilder dll.  Initially it was giving us errors about a messagbox for the windows console app until we switched Target Framework from ".NET Framewrk 4 Client Profile" to ".NET Framewrk 4". Our webservice is already .NET Framewrk 4, but for some reason still get that error only when I deploy the WS on IIS.

When we initially tested the Powerbuilder dll in C# I used a windows form, which everything worked fine. Then I tried calling the dll from a console application, this was the first time I received the messagebox error. I was getting this error because my dll is dependant on "System.Drawing.dll" (Not sure how powerbuilder decides which dlls to include when a .NET assemply is deployed). To fix this I switched the projects Target Framework from .NET Framewrk 4 Client Profile to .NET Framewrk 4.

Along with that I needed to add the code shown below to app.config file, because the powerbuilder dll is in .NET version 2.0, and until we migrate to PB 12 we cannot change that.
  <startup useLegacyV2RuntimeActivationPolicy="true">
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>

The web service has a target framework of .NET Framewrk 4, and I added the V2 runtime to web.config setting and everything worked fine when I debugged from VS2010. When I went to deploy the WS on IIS I started getting the messagebox errors again. The problem is VS has no issue running the code WITHOUT any alerts for dialog box/message box but not sure why it fails on IIS.
Please check the IIS Application pools for WS, is its running with correct .net framework.

My suggestion is to compile your .net WS using .net 2.0 and set you application pool to use .net framework 2.0.
ASKER CERTIFIED SOLUTION
Avatar of DotNet_Dev
DotNet_Dev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
We have to upgrade the PowerBuilder version from 11.5 to 12.  While googling,  we found this solution and implemented.  It worked so, I posted it and selected this as my solution.

I appreciate all the effort and time put into this issue.

Thank you!
Thank you!