3

我得到了一个 WCF 服务,它通过位于同一域内不同服务器上的 MSMQ 上的 WAS 进行侦听。

设置如下所示:

服务器 A:Windows Server 2008 在 IIS 上托管 WCF 服务。

服务器 B:Windows Server 2008(域控制器)托管私有 MSMQ(AD 集成)。

此外,我还在服务器 A 上运行了一个控制台客户端,它也使用 WCF 通过 MSMQ 向服务发送消息。目前,整个设置工作正常,服务处理来自客户端的消息。客户端的安全模式设置为transport,服务的安全模式设置为none

但是,当我将服务的安全模式也切换到transport不再处理消息时。我在服务上激活了跟踪,发现当服务尝试访问另一台服务器上的 MSMQ 时似乎有问题。none在两种安全模式和中都可以看到警告和错误消息(见下文)transport,但是当设置为none服务时,似乎会忽略问题并处理消息。

错误消息说:

将 'murdock.ltportale.intern\private$\EventSyncService/EventSynchorinzationService.svc' 队列路径名称转换为格式名称时出错:无法识别的错误 -1072824300 (0xc00e0014)。排队通道上的所有操作均失败。确保队列地址有效。MSMQ 必须在启用 Active Directory 集成的情况下安装并且可以访问它。

我不认为 MSMQ 的地址是错误的,因为服务可以使用安全模式找到它none。我也很确定 MSMQ 与 AD 集成一起运行,因为我花了 2 天时间才让它在我的环境中运行。

目前我不知道我做错了什么。在没有安全模式的情况下运行设置transport对我来说是没有选择的,因为我的下一步将是激活交易。而且我认为如果传输模式不起作用,那么事务模式也不起作用。


警告信息:

 ...
 <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">
     <TraceIdentifier>
         http://msdn.microsoft.com/de-DE/library/System.ServiceModel.Channels.MsmqQueueTransactionalStatusUnknown.aspx
     </TraceIdentifier>
     <Description>
         Cannot detect if the queue is transactional.
     </Description>
     <AppDomain>
         /LM/W3SVC/3/ROOT/EventSyncService-1-129509714416559522
     </AppDomain>
     <ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/StringTraceRecord">                               
         <FormatName> 
              DIRECT=OS:murdock.ltportale.intern\private$\EventSyncService/EventSynchorinzationService.svc
         </FormatName>
     </ExtendedData>
  </TraceRecord>
  ...

错误信息:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
        <EventID>131075</EventID>
        <Type>3</Type>
        <SubType Name="Error">0</SubType>
        <Level>2</Level>
        <TimeCreated SystemTime="2011-05-27T12:04:11.5292297Z" />
        <Source Name="System.ServiceModel" />
        <Correlation ActivityID="{f89d797c-3d10-47a3-8dad-1b3200d3b868}" />
        <Execution ProcessName="w3wp" ProcessID="1764" ThreadID="6" />
        <Channel />
        <Computer>SPS2010-FBE</Computer>
    </System>
    <ApplicationData>
        <TraceData>
            <DataItem>
                <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
                    <TraceIdentifier>
                        http://msdn.microsoft.com/de-DE/library/System.ServiceModel.Diagnostics.ThrowingException.aspx
                    </TraceIdentifier>
                    <Description>Throwing an exception.</Description>
                    <AppDomain>/LM/W3SVC/3/ROOT/EventSyncService-1-129509714416559522
                    </AppDomain>
                    <Exception>
                        <ExceptionType>
                            System.ServiceModel.MsmqException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
                        </ExceptionType>
                        <Message>
                            An error occurred when converting the 'murdock.ltportale.intern\private$\EventSyncService/EventSynchorinzationService.svc' queue path name to the format name: Unrecognized error -1072824300 (0xc00e0014). All operations on the queued channel failed. Ensure that the queue address is valid. MSMQ must be installed with Active Directory integration enabled and access to it is available.
                        </Message>
                        <StackTrace>
                               at System.ServiceModel.Channels.MsmqFormatName.FromQueuePath(String queuePath)
                               at System.ServiceModel.Channels.MsmqVerifier.VerifyReceiver(MsmqReceiveParameters receiveParameters, Uri listenUri)
                               at System.ServiceModel.Channels.MsmqTransportBindingElement.BuildChannelListener[TChannel](BindingContext context)
                               at System.ServiceModel.Channels.BindingContext.BuildInnerChannelListener[TChannel]()
                               at System.ServiceModel.Channels.MessageEncodingBindingElement.InternalBuildChannelListener[TChannel](BindingContext context)
                               at System.ServiceModel.Channels.BinaryMessageEncodingBindingElement.BuildChannelListener[TChannel](BindingContext context)
                               at System.ServiceModel.Channels.BindingContext.BuildInnerChannelListener[TChannel]()
                               at System.ServiceModel.Channels.Binding.BuildChannelListener[TChannel](Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, BindingParameterCollection parameters)
                               at System.ServiceModel.Description.DispatcherBuilder.MaybeCreateListener(Boolean actuallyCreate, Type[] supportedChannels, Binding binding, BindingParameterCollection parameters, Uri listenUriBaseAddress, String listenUriRelativeAddress, ListenUriMode listenUriMode, ServiceThrottle throttle, IChannelListener&amp;amp; result, Boolean supportContextSession)
                               at System.ServiceModel.Description.DispatcherBuilder.BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, Boolean supportContextSession, IChannelListener&amp;amp; result)
                               at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
                               at System.ServiceModel.ServiceHostBase.InitializeRuntime()
                               at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
                               at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
                               at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
                               at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
                               at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
                               at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
                               at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
                               at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
                               at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()
                               at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke()
                               at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ProcessCallbacks()
                               at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.CompletionCallback(Object state)
                               at System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
                               at System.ServiceModel.Diagnostics.Utility.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
                               at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
                        </StackTrace>
                        <ExceptionString>
                            System.ServiceModel.MsmqException: An error occurred when converting the 'murdock.ltportale.intern\private$\EventSyncService/EventSynchorinzationService.svc' queue path name to the format name: Unrecognized error -1072824300 (0xc00e0014). All operations on the queued channel failed. Ensure that the queue address is valid. MSMQ must be installed with Active Directory integration enabled and access to it is available.
                        </ExceptionString>
                    </Exception>
                </TraceRecord>
            </DataItem>
        </TraceData>
    </ApplicationData>
</E2ETraceEvent>

配置客户端

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
      <bindings>
        <netMsmqBinding>
          <binding name="MsmqBindingNonTransactionalNoSecurity" exactlyOnce="false">
            <security mode="None"/>
          </binding>
          <binding name="MsmqBindingNonTransactionalTransportSecurity" exactlyOnce="false">
            <security mode="Transport"/>
          </binding>
        </netMsmqBinding>
      </bindings>
      <client>
        <endpoint name="EventSyncService.EventSynchorinzationService"
                  address="net.msmq://murdock.ltportale.intern/private/EventSyncService/EventSynchorinzationService.svc"
                  binding="netMsmqBinding" 
                  bindingConfiguration="MsmqBindingNonTransactionalTransportSecurity"
                  contract="SyncService.IEventSynchorinzationService" />
      </client>
    </system.serviceModel>
</configuration>

配置服务

...
 <system.serviceModel>
    <bindings>
      <netMsmqBinding>
        <binding name="MsmqBindingNonTransactionalNoSecurity" exactlyOnce="false">
          <security mode="None" />
        </binding>
        <binding name="MsmqBindingNonTransactionalTransportSecurity" exactlyOnce="false">
          <security mode="Transport"/>
        </binding>
      </netMsmqBinding>
    </bindings>
    <services>
      <service name="EventSyncService.EventSynchorinzationService">
        <endpoint 
                  address="net.msmq://murdock.ltportale.intern/private/EventSyncService/EventSynchorinzationService.svc" 
                  binding="netMsmqBinding" 
                  bindingConfiguration="MsmqBindingNonTransactionalNoSecurity" 
                  contract="EventSyncService.IEventSynchorinzationService" />
      </service>
    </services>
  </system.serviceModel>
  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.ServiceModel"
              switchValue="Information, ActivityTracing"
              propagateActivity="true">
        <listeners>
          <add name="sdt"
              type="System.Diagnostics.XmlWriterTraceListener"
              initializeData= "c:\log\log.txt" />
        </listeners>
      </source>
    </sources>
  </system.diagnostics>
</configuration>
4

0 回答 0