2010-06-10 5 views
0

J'ai une application SL3 essayant de se connecter à un service WFC. L'application et le service sont sur des serveurs sécurisés différents sur le même domaine. L'application SL3 vit ici:Silverlight 3 avec service WCF -

https://www-r.aetc.af.mil/fm/tools/batsnet/authenticated/modules/blah bla

Lorsque le début de l'application SL, il se connecte immédiatement au service, mais quand il fait son premier appel au service, je reçois cette exception:

An exception occurred during the operation, making the result invalid. Check InnerException for exception details. 
    at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() 
    at FMDashboard2.FMDashSvc3Ref.GetMetricDataCompletedEventArgs.get_Result() 
    at FMDashboard2.Objects.DataRetrieval.service_GetMetricDataCompleted(Object sender, GetMetricDataCompletedEventArgs e) 
============ 
Inner exception: An error occurred while trying to make a request to URI 'https://bats.aetc.af.mil/fm/tools/FMDashSvc/FMDash3.svc'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may need to contact the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. This error may also be caused by using internal types in the web service proxy without using the InternalsVisibleToAttribute attribute. Please see the inner exception for more details. 
    at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result) 
    at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result) 
    at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result) 
    at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result) 
    at FMDashboard2.FMDashSvc3Ref.FMDash3Client.FMDash3ClientChannel.EndGetMetricData(IAsyncResult result) 
    at FMDashboard2.FMDashSvc3Ref.FMDash3Client.FMDashboard2.FMDashSvc3Ref.FMDash3.EndGetMetricData(IAsyncResult result) 
    at FMDashboard2.FMDashSvc3Ref.FMDash3Client.OnEndGetMetricData(IAsyncResult result) 
    at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result) 
============ 
Inner exception: 
    at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state) 
    at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult) 
    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result) 
============ 
Inner exception: Security error. 
    at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 
    at System.Net.Browser.BrowserHttpWebRequest.c__DisplayClass5.b__4(Object sendState) 
    at System.Net.Browser.AsyncHelper.c__DisplayClass2.b__0(Object sendState)

Voici mon ClientConfig:

<configuration> 
    <system.serviceModel> 
     <bindings> 
      <customBinding> 
       <binding name="SecureBinding_FMDashSvc"> 
        <binaryMessageEncoding /> 
        <httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> 
       </binding> 
       <binding name="LocalBinding_FMDashSvc"> 
        <binaryMessageEncoding /> 
        <httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" /> 
       </binding> 
      </customBinding> 
     </bindings> 

     <client> 
      <endpoint address="https://bats.aetc.af.mil/fm/tools/FMDashSvc/FMDash3.svc" 
         binding="customBinding" 
         bindingConfiguration="SecureBinding_FMDashSvc" 
         contract="FMDashSvc3Ref.FMDash3" 
         name="SecureEndPoint_FMDashSvc_GDIT_BATS" /> 
      <endpoint address="http://localhost:53519/FMDash3.svc" 
         binding="customBinding" 
         bindingConfiguration="LocalBinding_FMDashSvc" 
         contract="FMDashSvc3Ref.FMDash3" 
         name="LocalEndPoint_FMDashSvc" /> 
     </client> 
    </system.serviceModel> 
</configuration>

Voilà ma config web pour le service:

<system.serviceModel> 
    <behaviors> 
     <serviceBehaviors> 
      <behavior name="FMDashboardSvc3.StandardBehavior" > 
       <serviceMetadata httpsGetEnabled="true" /> 
       <serviceDebug includeExceptionDetailInFaults="true" /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 

    <bindings> 
     <wsHttpBinding > 
      <binding name="secureBinding"> 
       <security mode="Transport"> 
        <transport clientCredentialType="Certificate" /> 
       </security> 
      </binding> 
     </wsHttpBinding> 
    </bindings> 

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> 

    <services > 
     <service name="FMDashboardSvc3.FMDash3" behaviorConfiguration="FMDashboardSvc3.StandardBehavior"> 
      <endpoint address="/" 
         binding="wsHttpBinding" 
         bindingConfiguration="secureBinding" 
         contract="FMDashboardSvc3.FMDash3" /> 
     </service> 
    </services> 
</system.serviceModel> 

Et voici mon fichier clientaccesspolicy.xml:

<?xml version="1.0" encoding="utf-8" ?> 
<access-policy> 
    <cross-domain-access> 
     <policy> 
      <allow-from http-request-headers="SOAPAction"> 
       <domain uri ="http://*" /> 
       <domain uri ="https://*" /> 
      </allow-from> 
      <grant-to> 
       <resource path="/" include-subpaths="true"/> 
      </grant-to> 
     </policy> 

     <policy> 
      <allow-from https-request-headers="SOAPAction"> 
       <domain uri ="http://*" /> 
       <domain uri ="https://*" /> 
      </allow-from> 
      <grant-to> 
       <resource path="/" include-subpaths="true"/> 
      </grant-to> 
     </policy> 
    </cross-domain-access> 
</access-policy> 

Je travaille sur ce point pour SEMAINES. J'ai martelé à la fois Codeproject et les forums MSDN, et personne n'a été capable de trouver une solution pour moi. Aidez-moi, obi-wan-kenobi.

+0

Utilisez-vous des certificats autosignés ou des certificats réels? –

+0

Je crois que ce sont des certificats réels. C'est un domaine de la Force aérienne et ils utilisent des cartes CAC pour l'authentification de l'utilisateur. – jsop

+0

BTW, je ne l'ai pas mentionné, mais je peux naviguer directement vers le service, mais le frapper à travers l'application Silverlight refuse de travailler. – jsop

Répondre

0

Je pense que le problème peut être lié au clientCredentialType côté serveur. E.g .:

<security mode="Transport"> 
    <transport clientCredentialType="Certificate" /> 
</security> 

Je ne pense pas que Silverlight supporte ce type d'informations d'identification client au niveau du transport.

+0

Eh bien, si je le change à n'importe quel autre type d'identification, je ne peux pas passer directement au service. – jsop

0

Vous avez exposé votre service en tant que liaison Ws que Silverlight ne prend pas en charge. Si vous utilisez les mêmes paramètres de sécurité avec basicHttpBinding, cela devrait fonctionner.

Questions connexes