2

我创建了一个进程监视程序 (C#),它使用 WCF 来处理来自我在服务器上运行的多个进程的日志记录。一切都是服务器本地的,WCF 基地址是“net.pipe://localhost/ServiceDebugHost”。当我从资源管理器中运行它们时,它们会打开与监控程序的连接并向其发送消息,它会显示这些消息。

但是,当我在任务计划程序 (Windows Server 2008R2) 下运行它们时,没有消息到达。我在管理员帐户下运行计划任务。

服务器的服务模型是:

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="">
                <serviceMetadata httpGetEnabled="false" />
                <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service name="ServiceDebugHost.CommService">
            <endpoint address="" binding="netNamedPipeBinding" contract="ServiceDebugHost.ICommService">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" />
            <host>
                <baseAddresses>
                    <add baseAddress="net.pipe://localhost/ServiceDebugHost" />
                </baseAddresses>
            </host>
        </service>
    </services>
</system.serviceModel>

客户端服务模式为:

<system.serviceModel>
    <bindings>
        <netNamedPipeBinding>
            <binding name="NetNamedPipeBinding_ICommService" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288"
                maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="Transport">
                    <transport protectionLevel="EncryptAndSign" />
                </security>
            </binding>
        </netNamedPipeBinding>
    </bindings>
    <client>
        <endpoint address="net.pipe://localhost/ServiceDebugHost" binding="netNamedPipeBinding"
            bindingConfiguration="NetNamedPipeBinding_ICommService" contract="LogService.ICommService"
            name="NetNamedPipeBinding_ICommService">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

任何想法为什么它不会在任务计划程序下发送消息?

谢谢。

这是事件查看器中显示的异常:

Application: Monitor.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ServiceModel.EndpointNotFoundException
Stack:

Server stack trace: 
   at System.ServiceModel.Channels.PipeConnectionInitiator.GetPipeName(Uri uri, IPipeTransportFactorySettings transportFactorySettings)
   at System.ServiceModel.Channels.NamedPipeConnectionPoolRegistry.NamedPipeConnectionPool.GetPoolKey(EndpointAddress address, Uri via)
   at System.ServiceModel.Channels.CommunicationPool`2.TakeConnection(EndpointAddress address, Uri via, TimeSpan timeout, TKey& key)
   at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
   at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
   at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Messaging.IMessage)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(System.Runtime.Remoting.Proxies.MessageData ByRef, Int32)
   at Monitor.LogService.ICommService.ServiceMessage(System.String, Int32, System.String)
   at Monitor.Program.Log(Int32, System.String)
   at Monitor.Program.Main(System.String[])
4

0 回答 0