您可以公开托管Windows服务吗? [英] Can you expose a Managed Windows Service?

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

问题描述

所以我想知道是否有一种方法可以在Windows Server 没有 IIS上公开托管Windows服务?

我们为管理员用户提供了一个工作示例,但是由于这是ADFS类型的情况,因此,当任何其他用户尝试访问SVC时,他们将被击落(500);


(链接甚至特定的搜索主题都很好).

So I''m wondering if there is a way to expose a Managed Windows Service on Windows Server without IIS?

we had a working sample for an admin user, however because this is an ADFS type situation, when any other user attempts to access the SVC they are shot down (500);


(links or even specific search topics are good)

推荐答案

首先:Windows Service本身与IIS完全无关.这只是OS以特殊方式托管的通用服务-使用Service Control Magager,请参见 [ ^ ], http://en.wikipedia.org/wiki/ADFS [^ ]).所以呢?您也可以使用它. "SVC"也需要消除歧义.是什么服务无法启动"?您的代码在哪里?问题是如何表现出来的?请以足够的详细程度描述您的问题,并…使用较少的缩写.

如果要在Windows服务中查找错误,则需要在每个线程的堆栈顶部捕获所有异常并正确记录它们.最可靠的日志记录方式是系统事件日志.
在此处找到System.EventLog的一些代码示例:
如何在文件夹下创建事件日志 [ ^ ]
将MsBuild OutPut即时发送到TextBox Windows应用程序中 [ ^ ].

也很有可能使用调试器,您应该能够将调试器连接到现有的已经运行的进程.请参阅调试器文档.它需要对调试会话进行全面的计划,否则,如果它们在服务启动的最开始就出现,您将错过这些问题.

—SA
First of all: Windows Service itself have nothing to do with IIS at all. This is just a general-purpose Service hosted by OS in a special way — using Service Control Magager, see [^], http://en.wikipedia.org/wiki/Service_Control_Manager[^]. With a managed platform (.NET) it can communicate with applications and other services on the same or remote machines using number of ways: WCF or remoting, low-level sockets, named pipes (on the same system) and more.

It is not clear what do you mean by "ADFS situation", most likely, you mean "Active Directory" (if disambiguation is still needed: http://en.wikipedia.org/wiki/ADFS[^]). So what? You can use it, too. "SVC" also needs disambiguation. Is it "Service cannot start" of what? Where is your code? How the problem is manifested? Please describe your problem with sufficient level of detail and… try to use less abbreviations.

If your want to find bugs in a Windows Service, you need to catch all exceptions at the top of stack of each thread and log them properly. The most reliable way of logging is the System Event Log.
Find some code samples of System.EventLog here:
How to create event log under a folder[^]
MsBuild OutPut to the TextBox on the fly in Windows Application[^].

Using debugger is also quite possible, you should be able to attach the debugger to existing already running process. Refer to debugger documentation. It need thorough planning of your debugging session, otherwise you will miss the problems if they occur in the very beginning of the Service start.

—SA


这篇关于您可以公开托管Windows服务吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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