带 Windows 服务的 SqlWebEventProvider
我正在尝试从 Windows 服务向 SqlWebEventProvider
引发一些自定义事件。以下是我已采取的步骤和我看到的结果。我无法弄清楚这一点。
设置 2
healthMonitoring
提供程序SqlWebEventProvider
和SimpleMailWebEventProvider
(都是 .net 2.0 框架,sqlwebeventprovider 基本上是默认的,带有修改后的连接)字符串名称)设置引发相同事件类型的网站和 Windows 服务
将 healthmonitoring 元素从全局 web.config 移动到 machine.config (以便 Windows 服务可以获取配置)..(healthmonitoring 默认值位于全局 web.config 中,所以它们不能从 Windows 服务继承,这就是为什么我必须将默认值移至机器)
这是我所做的测试
为了测试此场景,我从网站向两个提供商提出了一个事件,并且运行良好。然后在 Windows 服务中,我向两者都引发了事件,并且它仅适用于 SimpleMailWebEventProvider。
我确保 SqlWebEventProvider
的连接字符串是正确的(它们都得到了来自 machine.config 的 conn 字符串)。
我将整个 HealthMonitoring
元素从 web.config 复制到 Windows 服务配置文件,但仍然得到相同的行为。
我重新启动了该服务,卸载了它并重新安装了它......仍然是相同的行为。
这是我确信的信息
- 提供商没有任何问题,两者都可以在网站上运行。
- 网站和 Web 服务可以以相同的方式从 machine.config 继承
- 连接字符串正确
- 事件正在引发
- 对于 Windows 服务和网站,事件可以引发到
SimpleMailWebEventProvider
- 事件可以引发到
SqlWebEventProvider
仅来自网站
I am trying to raise some custom events to a SqlWebEventProvider
from a windows service. Here are the steps I have taken and the results I have seen. I cannot figure this one out.
Setup 2
healthMonitoring
providersSqlWebEventProvider
, andSimpleMailWebEventProvider
(both .net 2.0 framework, and sqlwebeventprovider is basically the default one w/ modified connection string name)Setup website and windows service that both raise same event type
Moved healthmonitoring element from global web.config to machine.config (so windows service could pick up the configuration).. (the healthmonitoring defaults are located in global web.config, so they would not be inheritable from windows services, so this is why i had to move the defaults to machine)
Here is what I did to test
To test this scenerio, I raised an event from the website to both providers and it worked fine. Then in the windows service I raised the events to both and it only works to the SimpleMailWebEventProvider.
I made sure that the connection strings were correct for the SqlWebEventProvider
(they are both getting conn string from machine.config).
I copied the entire HealthMonitoring
element from the web.config to the windows service config file and still get the same behavior.
I restarted the service, uninstalled it reinstalled it... still, same behavior.
Here is what I know for sure
- There is nothing wrong with the providers, both will work from website.
- Websites and web services can inherit from machine.config the same way
- The connection string is correct
- The events are raising
- The events can raise to the
SimpleMailWebEventProvider
for both windows service and website - The events can raise to the
SqlWebEventProvider
only from the website
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现问题
“aspnet_WebEvent_LogEvent”需要参数“@ApplicationPath”,但未提供该参数。
I found the issue
'aspnet_WebEvent_LogEvent' expects parameter '@ApplicationPath', which was not supplied.