使用WAS的WCF服务:服务无法转换队列的路径名

时间:2011-05-27 13:08:32

标签: wcf transactions msmq wcf-security was

我有一个WCF服务在MSMQ上侦听via WAS,该MSMQ位于同一域内的不同服务器上。

设置如下:

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

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

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

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

错误消息显示:

  

转换时发生错误   'murdock.ltportale.intern \私人$ \ EventSyncService / EventSynchorinzationService.svc'   队列路径名称为格式名称:   无法识别的错误-1072824300   (0xc00e0014)。所有的操作都在   排队频道失败。确保   队列地址有效。 MSMQ必须是   与Active Directory一起安装   集成已启用并可访问它   是可用的。

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

目前我不知道自己做错了什么。我没有选择运行没有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>

0 个答案:

没有答案