2011-12-30 12 views
1

私はWCFパブリッシュサブスクリプショントピックサービスを構築しましたが、コンソールアプリケーション(これは少なくともコンソールで動作することはわかっています)を使用してパブリッシュ/私のSilverlightアプリケーションで両方のサービス参照を正常に追加できます。WCF with Silverlight 4、パブリッシュサブスクライブUserName Auth ServiceSecurityContext.Current NULL参照

問題:

私は(いつでも、私は自分のユーザー名とパスワードを通過し、他の言葉で)サブスクライブまたはパブリッシュしようとするたびSilverlightを使用している間、ServiceSecurityContext.Current.PrimaryIdentityはNULLです、コンソールで正常に動作します。また、サービスにアクセスすると、カスタムのユーザー名とパスワードのバリデータがSilverlightからアクセスする際にヒットすることはありませんが、コンソールからは実行されます。

私の要件は何ですか?

私はSilverlight経由で公開購読サービスを利用する必要があります。 WCFサービスはユーザー名認証を必要とします。 WCFサービスは、Silverlightでの使用を可能にしながら、できるだけ安全である必要があります。私は.Netを使用しなければならない、私はWCF PubSubTopicを使用しなければならない、私はSilverlightを使用する必要があります。

私は、複数のサブスクライバエンドポイントを作成することはできます(たとえば、SLで使用するカスタムのエンドポイントと、apiユーザーで使用するカスタムエンドポイントなど)がありますが、他のAPIユーザーと同じパブリッシャを使用する必要がありますええと、btw、WCFサービスはユーザーがアクセスできるようにAPIとして構築されています...私は加入者へのアクセスのみを許可しており、発行者をブロックしています)

私は、アドバイス、および/またはトラブルシューティングが私の現在の問題に役立ちます。ここで何か

Private Const PUBLISHER_ENDPOINT_ADDRESS As String = "http://myserver/portal/api/v1/Publisher.svc" 

    Friend Shared Sub PublishSomething() 

     Dim binding As PollingDuplexHttpBinding = New PollingDuplexHttpBinding() 

     Dim endpoint_address As EndpointAddress = New EndpointAddress(PUBLISHER_ENDPOINT_ADDRESS) 

     Dim client As New PublisherClient(binding, endpoint_address) 

     client.ClientCredentials.UserName.UserName = String.Format("{0}\{1}", Common.CompanyName, Common.UserName) 

     client.ClientCredentials.UserName.Password = "mypassword" 

     Dim uUpdate As New PortalPublisherService.UserUpdatedNotification 

     uUpdate.CompanyID = CompanyId 

     uUpdate.CompanyName = CompanyName 

     uUpdate.isAdvisor = True 

     uUpdate.isMaster = True 

     uUpdate.MetaNotes = "Testing from silverlight." 

     uUpdate.updateById = UserId 

     uUpdate.updateByName = UserName 

     uUpdate.userEmail = "[email protected]" 

     uUpdate.userId = UserId 

     client.UserUpdateAsync(uUpdate) 

    End Sub 

を公開しようとしているのSilverlightの私のコードの一部

VB.NETコードは、ここで私は私が試したことを強調したいサービス

<system.serviceModel> 

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/> 

    <protocolMapping> 
     <add scheme="http" binding="wsDualHttpBinding"/> 
    </protocolMapping> 

    <extensions> 
     <bindingExtensions> 
     <add name="pollingDuplexHttpBinding" 
      type="System.ServiceModel.Configuration.PollingDuplexHttpBindingCollectionElement, 
      System.ServiceModel.PollingDuplex, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /> 
     </bindingExtensions> 
    </extensions> 

    <behaviors> 

     <serviceBehaviors> 
     <!--primary behavior--> 
     <behavior name="Portal.Api.Behavior"> 
      <serviceMetadata httpGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
      <serviceCredentials> 
      <serviceCertificate findValue="PortalApiCert" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName"/> 
      <clientCertificate> 
       <authentication certificateValidationMode="PeerOrChainTrust" revocationMode="NoCheck"/> 
      </clientCertificate> 
      <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Portal.Web.UserPassAuth, Portal.Web"/> 
      </serviceCredentials> 
     </behavior> 
     </serviceBehaviors> 

    </behaviors> 

    <bindings> 

<pollingDuplexHttpBinding> 
     <binding name="pollingBindingConfig" 
       closeTimeout="00:01:00" 
       openTimeout="00:01:00" 
       receiveTimeout="00:10:00" 
       sendTimeout="00:01:00" 
       transferMode="Buffered" 
       hostNameComparisonMode="StrongWildcard" 
       maxBufferPoolSize="5242880" 
       maxBufferSize="655360" 
       maxReceivedMessageSize="655360"> 
      <readerQuotas maxDepth="32" 
         maxStringContentLength="81920" 
         maxArrayLength="163840" 
         maxBytesPerRead="16384" 
         maxNameTableCharCount="163840" /> 
      <security mode="TransportCredentialOnly" /> 
     </binding> 
     </pollingDuplexHttpBinding> 

    </bindings> 
    <services> 
    <!--publisher endpoint configuration settings--> 
     <service behaviorConfiguration="Portal.Api.Behavior" name="Portal.Web.Publisher"> 
     <endpoint address="" binding="pollingDuplexHttpBinding" contract="Portal.Publisher.IPublisher" bindingConfiguration="pollingBindingConfig"/> 
     <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="meta"/> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://server/portal/api/v1/IPublisher"/> 
      </baseAddresses> 
     </host> 
     </service> 
    </services> 
    </system.serviceModel> 

からweb.configファイルだです比喩的には100万の異なる構成ですが、私が試したすべての組み合わせを覚えていません。私は設定でいくつかのことをやっているのは分かっていますが、私はそれを作業期間にしようとしていました。また、ここで私はすでに

this one and this one

を事前に

おかげで...よく...それは長い1日だった...そこに多くのですが、見てきたリンクです任意のヘルプ

追加注:

これは私が成功したNON-のSilverlightの実装

を使用してい結合されます
<wsDualHttpBinding> 
    <binding name="Portal.Api.Binding" maxReceivedMessageSize="2147483647" sendTimeout="00:10:00"> 
     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> 
     <security mode="Message"> 
     <message clientCredentialType="UserName" negotiateServiceCredential="false"/> 
     </security> 
    </binding> 
    </wsDualHttpBinding> 

答えて

0

誰もこれに答えなかったので、私は私の所見でこれに答えます。私がここで探しているのは、RIAサービスとSilverlight over HTTPSでは不可能です。 WCF RIAサービスは、現時点ではこの機能を提供していません。この声明が真実ではないことが分かっているなら、上記の私の質問に解答してください。

関連する問題