Solved

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

Posted on 2011-09-22
7
1,367 Views
Last Modified: 2013-12-20
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!
0
Comment
Question by:DotNet_Dev
  • 4
  • 2
7 Comments
 
LVL 13

Expert Comment

by:khairil
ID: 36585083
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.
0
 
LVL 8

Expert Comment

by:jagrut_patel
ID: 36585227
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!
0
 

Author Comment

by:DotNet_Dev
ID: 36717204
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.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 13

Expert Comment

by:khairil
ID: 36812748
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.
0
 

Accepted Solution

by:
DotNet_Dev earned 0 total points
ID: 37096474
As I said before, our .net 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 web service.

Initially, the PowerBuilder dll was deployed to .net using PowerBuilder 11.5 version which has  'modal dialog box' error message.   We redeployed the same dll using PowerBuilder version 12.0 and the problem has been fixed.

Thank you all for your time!
0
 

Author Closing Comment

by:DotNet_Dev
ID: 37123905
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!
0
 

Author Comment

by:DotNet_Dev
ID: 37096522
Thank you!
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

What is an ISAPI filter?   •      It's an assembly (.dll file) that can add or change the way IIS works.   •      They can be enabled globally for your web server or on a site-by-site basis.   When the IIS server receives a request, enabling the ISAPI fi…
Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now