服务有形式吗? [英] Can services have forms?

查看:78
本文介绍了服务有形式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我读过的地方服务不是(或不能)有表格。


这是真的吗?

解决方案



" jim" < ji*@yourpc.eduwrote in message

news:nk ****************** @ bignews5.bellsouth.net ..


>我以为我读过的地方服务不是(或不能)有表格。


这是真的吗?



服务不使用表单,因为该服务一旦启动/执行就意味着无人值守运行
,没有用户接口。


但是使用表单的Windows桌面应用程序可以与

服务应用程序进行通信,就像您看到个人防火墙UI一样

与其FW服务应用程序进行通信。




" Mr。阿诺德" < MR。 Ar****@Arnold.com 在留言中写道

新闻:%2 **** *********** @ TK2MSFTNGP04.phx.gbl ...


>

" jim" < ji*@yourpc.eduwrote in message

news:nk ****************** @ bignews5.bellsouth.net ..


>>我以为我读过的地方服务不是(或不能)有表格。

真的吗?



服务不使用表单,因为该服务在启动/执行后无人值守运行

,没有用户接口。


但是使用表单的Windows桌面应用程序可以与

a服务应用程序通信,就像你看到个人防火墙UI那样

与其FW服务应用程序通信。



您知道我可以从中学到的任何示例吗?


" jim" < ji*@yourpc.eduwrote in message

news:nk ****************** @ bignews5.bellsouth.net ..


>我以为我读过的地方服务不是(或不能)有表格。


这是真的吗?



不,不是真的。 Windows服务可以拥有它想要的所有表单。

甚至还有一个小小的允许服务与桌面交互。检查

框,你可以在服务管理界面浏览。


现在,关于拥有Windows服务表格的智慧,这是另一个

的故事。如果你走这条路,你需要一个很好的答案,怎么办

如果没有人登录?,以及所有边缘情况。


大多数人通过让服务没有任何表单代码来解决这个问题,并且

而是使用远程处理代理和管理应用程序。这似乎更好。

更好。只需查看Remoting即可。你会在CodeProject上找到很多例子




如果你想在服务中使用表单只是为了调试,你可以

采取混合方法:
http://www.coversant.com/dotnetnuke/...=88&EntryID=19


我在那里谈论的方法适用于Console和WinForms应用程序。


-

Chris Mullins,MCSD.NET,MCPD:Enterprise,Microsoft C#MVP
http://www.coversant.com/blogs/cmullins


I thought that I read somewhere that services don''t (or can''t) have forms.

Is that true?

解决方案


"jim" <ji*@yourpc.eduwrote in message
news:nk******************@bignews5.bellsouth.net.. .

>I thought that I read somewhere that services don''t (or can''t) have forms.

Is that true?

A service doesn''t use forms, because the service is meant to run unattended
once it''s started/executed, with no user interfacing.

But a Windows desktop application using a form can communicate with with a
service application, just like you see a personal firewall UI that
communicates with its FW service application.



"Mr. Arnold" <MR. Ar****@Arnold.comwrote in message
news:%2***************@TK2MSFTNGP04.phx.gbl...

>
"jim" <ji*@yourpc.eduwrote in message
news:nk******************@bignews5.bellsouth.net.. .

>>I thought that I read somewhere that services don''t (or can''t) have forms.

Is that true?


A service doesn''t use forms, because the service is meant to run
unattended once it''s started/executed, with no user interfacing.

But a Windows desktop application using a form can communicate with with
a service application, just like you see a personal firewall UI that
communicates with its FW service application.

Do you know of any examples of this that I can learn from?


"jim" <ji*@yourpc.eduwrote in message
news:nk******************@bignews5.bellsouth.net.. .

>I thought that I read somewhere that services don''t (or can''t) have forms.

Is that true?

Nope, not true at all. A Windows Service can have all the forms it want.
There''s even a handly little "Allow Service to Interact with Desktop" check
box you can explore in the service admin screen.

Now, as to the wisdom of having a Windows Service do Forms, that''s another
story. If you go this route, you need to have a good answer for "What to do
if nobody is logged in?", and all of the edge cases around that.

Most people solve this by having the Service not have any Forms code, and
instead use a Remoting Proxy and an Admin Application. This seems to work
better. Just go look up "Remoting" and you''ll find a number of examples all
over CodeProject.

If you want forms in your service simply for the sake of debugging, you can
take the hybrid approach:
http://www.coversant.com/dotnetnuke/...=88&EntryID=19

The approach I talk about there works for Console and WinForms apps.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins


这篇关于服务有形式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆