It is invalid to show a modal dialog or form when the application

G

Guest

I have a 'solution' with a Webservice, Business layer and a data layer. In
the Business layer I've added a form that need to be started on the
server(this site has full rights, runs with Local System account), th BL is
called from the WS. So in my Business layer I've added code to start and
close the form, but I get the error:

"It is invalid to show a modal dialog or form when the application is not
running in UserInteractive mode. Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service application"

I've found info how to start a MessageBox, but I need to run the complete
form, not just a MessageBox.
How can I solve this?
 
N

Nicholas Paldino [.NET/C# MVP]

You are going to have to split up your process into multiple actions.
Basically, the WebService should not be showing any UI. What you can do is
have the UI make the call to the first web service, and if that succeeds,
show whatever UI element you need, then proceed to the next web service, and
so on, and so on.

Hope this helps.
 
G

Guest

Hi!

I think you missunderstod me.
I call the webService, the WS calls a DLL(Business Layer). The BL contains
also a class file(the actuall BL) and a form, the form is called from the BL.

Client->webservice->BL->form
A dataset and som othe variables are passed to the form that render an
invoice from a panel and a bunch of labels, the panel with all containing
controls(labels and pictureboxes) are printed with a printdocument in the
form. That's how it works, is there any other way I can do this?

I tried to create a picture of the invoice on the client side and send the
image to the webservice and print it from there, but the quality was so bad
that it couldn't be used, tried to create png,gif,jpg,bmp and tiff, same
result with all. The code to render the image was the same that was used to
render the printdocument.

Regards
Anders Aleborg


Nicholas Paldino said:
You are going to have to split up your process into multiple actions.
Basically, the WebService should not be showing any UI. What you can do is
have the UI make the call to the first web service, and if that succeeds,
show whatever UI element you need, then proceed to the next web service, and
so on, and so on.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have a 'solution' with a Webservice, Business layer and a data layer. In
the Business layer I've added a form that need to be started on the
server(this site has full rights, runs with Local System account), th BL
is
called from the WS. So in my Business layer I've added code to start and
close the form, but I get the error:

"It is invalid to show a modal dialog or form when the application is not
running in UserInteractive mode. Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service
application"

I've found info how to start a MessageBox, but I need to run the complete
form, not just a MessageBox.
How can I solve this?
 
N

Nicholas Paldino [.NET/C# MVP]

Anders,

You should not be calling any user interface functions in your web
service, at all. You can't show a form or render it on the server side, as
it would require interaction with the desktop (which your service should
never be doing, since there will probably be no desktop).

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi!

I think you missunderstod me.
I call the webService, the WS calls a DLL(Business Layer). The BL contains
also a class file(the actuall BL) and a form, the form is called from the
BL.

Client->webservice->BL->form
A dataset and som othe variables are passed to the form that render an
invoice from a panel and a bunch of labels, the panel with all containing
controls(labels and pictureboxes) are printed with a printdocument in the
form. That's how it works, is there any other way I can do this?

I tried to create a picture of the invoice on the client side and send the
image to the webservice and print it from there, but the quality was so
bad
that it couldn't be used, tried to create png,gif,jpg,bmp and tiff, same
result with all. The code to render the image was the same that was used
to
render the printdocument.

Regards
Anders Aleborg


Nicholas Paldino said:
You are going to have to split up your process into multiple actions.
Basically, the WebService should not be showing any UI. What you can do
is
have the UI make the call to the first web service, and if that succeeds,
show whatever UI element you need, then proceed to the next web service,
and
so on, and so on.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have a 'solution' with a Webservice, Business layer and a data layer.
In
the Business layer I've added a form that need to be started on the
server(this site has full rights, runs with Local System account), th
BL
is
called from the WS. So in my Business layer I've added code to start
and
close the form, but I get the error:

"It is invalid to show a modal dialog or form when the application is
not
running in UserInteractive mode. Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service
application"

I've found info how to start a MessageBox, but I need to run the
complete
form, not just a MessageBox.
How can I solve this?
 
G

Guest

ok, do you have any suggestions on how to solve my problem.
As I described in my prevus post with sending an invoice to a printer on the
server, through a webservice?

Nicholas Paldino said:
Anders,

You should not be calling any user interface functions in your web
service, at all. You can't show a form or render it on the server side, as
it would require interaction with the desktop (which your service should
never be doing, since there will probably be no desktop).

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi!

I think you missunderstod me.
I call the webService, the WS calls a DLL(Business Layer). The BL contains
also a class file(the actuall BL) and a form, the form is called from the
BL.

Client->webservice->BL->form
A dataset and som othe variables are passed to the form that render an
invoice from a panel and a bunch of labels, the panel with all containing
controls(labels and pictureboxes) are printed with a printdocument in the
form. That's how it works, is there any other way I can do this?

I tried to create a picture of the invoice on the client side and send the
image to the webservice and print it from there, but the quality was so
bad
that it couldn't be used, tried to create png,gif,jpg,bmp and tiff, same
result with all. The code to render the image was the same that was used
to
render the printdocument.

Regards
Anders Aleborg


Nicholas Paldino said:
You are going to have to split up your process into multiple actions.
Basically, the WebService should not be showing any UI. What you can do
is
have the UI make the call to the first web service, and if that succeeds,
show whatever UI element you need, then proceed to the next web service,
and
so on, and so on.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have a 'solution' with a Webservice, Business layer and a data layer.
In
the Business layer I've added a form that need to be started on the
server(this site has full rights, runs with Local System account), th
BL
is
called from the WS. So in my Business layer I've added code to start
and
close the form, but I get the error:

"It is invalid to show a modal dialog or form when the application is
not
running in UserInteractive mode. Specify the ServiceNotification or
DefaultDesktopOnly style to display a notification from a service
application"

I've found info how to start a MessageBox, but I need to run the
complete
form, not just a MessageBox.
How can I solve this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top