編輯:更多的細節:我的問題更爲tokenprovider添加憑據在web.config中
一點點信息:
我用的是服務總線的異步事件發送到WCF服務。我有一個這樣配置的客戶端:
<client>
<endpoint address="sb://[Server].[Domain]/NameSpace/eventqueue"
behaviorConfiguration="securityBehavior" binding="netMessagingBinding"
bindingConfiguration="messagingBinding" contract="xxx.IEventQueueService"
name="Subscriber" />
</client>
請注意,它是我們自己的域中的虛擬服務器。
這是行爲和bindingConfig:
<behavior name="securityBehavior">
<transportClientEndpointBehavior>
<tokenProvider>
<windowsAuthentication>
<stsUris>
<stsUri value="https://[Server].[Domain]:9355/[Namespace]" />
</stsUris>
</windowsAuthentication>
</tokenProvider>
</transportClientEndpointBehavior>
</behavior>
<netMessagingBinding>
<binding name="messagingBinding" closeTimeout="00:03:00" openTimeout="00:03:00" receiveTimeout="00:03:00" sendTimeout="00:03:00" sessionIdleTimeout="00:01:00" prefetchCount="-1">
<transportSettings batchFlushInterval="00:00:01" />
</binding>
</netMessagingBinding>
我的WCF服務使用相同的配置:
<services>
<service name="xxx.EventQueueService">
<endpoint address="sb://[SERVER].[DOMAIN]/Namespace/eventqueue"
behaviorConfiguration="securityBehavior" binding="netMessagingBinding"
bindingConfiguration="messagingBinding" name="EventQueueClientService"
contract="xxx.IEventQueueService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/xxx.ExternalServices/EventQueueService" />
</baseAddresses>
</host>
</service>
</services>
,如果我我的開發計算機上運行我的項目這個偉大的工程。但現在,我想將它部署到服務器,與我的服務總線一樣。而失敗......
老編輯:好吧,我發現這個網頁:http://msdn.microsoft.com/en-us/library/microsoft.servicebus.configuration.windowselement.aspx
但是這兩個選項不起作用:
<windowsAuthentication userName="xxx" password="xxx" domain="xxx">
System.ArgumentNullException: Value cannot be null.
Parameter name: s
at System.Convert.FromBase64String(String s)
at Microsoft.ServiceBus.SharedSecretTokenProvider.DecodeSecret(String issuerSecret)
at Microsoft.ServiceBus.Description.SharedSecretCredential.CreateTokenProvider()
at Microsoft.ServiceBus.Description.TransportClientCredentialBase.get_TokenProvider()
at Microsoft.ServiceBus.TransportClientEndpointBehavior.get_TokenProvider()
at Microsoft.ServiceBus.Messaging.NetMessagingTransportBindingElement.CreateMessagingFactorySettings(BindingContext context)
at Microsoft.ServiceBus.Messaging.Channels.ServiceBusChannelListener`1..ctor(BindingContext context, NetMessagingTransportBindingElement transport)
at Microsoft.ServiceBus.Messaging.NetMessagingTransportBindingElement.BuildChannelListener[TChannel](BindingContext context)
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& result, Boolean supportContextSession)
at System.ServiceModel.Description.DispatcherBuilder.BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, Boolean supportContextSession, IChannelListener& 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 Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)
和
<windowsAuthentication>
<userName value="xxx">
= > Property「userName」不是ConfigurationElement
的servicebus DLL的哪個版本,你在你的web應用程序中使用?來自NuGet的 –
1.8.0.0。 (用於Windows Server的Service Bus 1.0) –