title: Consuming WCF Service through https from Silverlight
body: <p>I'm trying this example code:
  <a href="http://www.dotnetcurry.com/ShowArticle.aspx?ID=624" rel="nofollow">http://www.dotnetcurry.com/ShowArticle.aspx?ID=624</a></p>
  
  <p>Everything seems to be ok but when it tries to call the async method from the WCF it shows this exception (sorry it's just in spanish):</p>
  
  <blockquote>
    <p>Se ha producido un error al intentar realizar una solicitud al URI
    'https://samsung/WCF40_SSL_Service/Service.svc'. Puede deberse a un
    intento de acceso a un servicio de configuración entre dominios sin
    una política entre dominios adecuada en contexto o una política no
    apropiada para servicios SOAP. Es posible que necesite ponerse en
    contacto con el propietario del servicio para publicar un archivo de
    política entre dominios y para asegurarse de que permite enviar
    encabezados HTTP relacionados con SOAP. Este error también puede
    deberse al uso de tipos internos en el proxy de servicios web sin
    utilizar el atributo InternalsVisibleToAttribute. Para obtener más
    información, consulte la excepción interna.</p>
  </blockquote>
  
  <h2>English translation from <a href="http://www.freetranslation.com/" rel="nofollow">freetranslation.com</a> (not sure it helps:)</h2>
  
  <blockquote>
    <p>An error has been produced upon trying to carry out a request to the URI 'https://samsung/WCF40_SSL_Service/Service.svc'.  Due to an intent of access to a service 
    of configuration among controls without a politics among adequate controls in context or a not appropriate politics for services SOAP.  It is possible that need to be put in contact with the owner of the service to publish a file of politics between controls and to be assured that permits to send headlines HTTP related to SOAP.  This error also due to the use of internal types in the proxy of services web without utilizing the attribute InternalsVisibleToAttribute.  To obtain more information, consult the internal exception.  </p>
  </blockquote>
  
  <p>This seems to me like a "clientaccesspolicy.xml" problem but I'm pretty sure it's ok and it's been placed in the root path, in application path, its parent...</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;access-policy&gt;
      &lt;cross-domain-access&gt;
          &lt;policy&gt;
              &lt;allow-from http-request-headers="*"&gt;
                  &lt;domain uri="*"/&gt;
              &lt;/allow-from&gt;
              &lt;grant-to&gt;
                  &lt;resource path="/" include-subpaths="true"/&gt;
              &lt;/grant-to&gt;
          &lt;/policy&gt;
      &lt;/cross-domain-access&gt;
  &lt;/access-policy&gt;
  </code></pre>
  
  <p>I tried to see in fiddler if the application was sending the clientaccesspolicy.xml request but it isn't!!! It doesn't try to even find the file...</p>
  
  <p>I think I must be missing something trivial but I can't realize what... Any idea??</p>
  
  <p>Thanks in advance!!!</p>
  
  <p>Server config:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
      &lt;connectionStrings&gt;
          &lt;add  name="SqlSecureConnection" connectionString="Data Source=.;
                Initial Catalog=aspnetdb;Integrated Security=SSPI"/&gt;
      &lt;/connectionStrings&gt;
      &lt;system.web&gt;
          &lt;roleManager enabled="true" /&gt;
          &lt;authentication mode="Forms" /&gt;
          &lt;compilation debug="true" targetFramework="4.0" /&gt;
  
          &lt;membership defaultProvider="MySqlMembershipProvider"  
                      userIsOnlineTimeWindow="15"&gt;
              &lt;providers&gt;
                  &lt;clear /&gt;
                  &lt;add
                    name="MySqlMembershipProvider"
                    type="System.Web.Security.SqlMembershipProvider"
                    connectionStringName="SqlSecureConnection"
                    applicationName="/"
                    enablePasswordRetrieval="false"
                    enablePasswordReset="false"
                    requiresQuestionAndAnswer="false"
                    requiresUniqueEmail="true"
                    passwordFormat="Hashed" /&gt;
              &lt;/providers&gt;
          &lt;/membership&gt;
      &lt;/system.web&gt;
      &lt;system.serviceModel&gt;
          &lt;services&gt;
              &lt;service name="WCF_SecureService.Service" 
                       behaviorConfiguration="ServBehave"&gt;
                  &lt;endpoint
                     address=""
                      binding="customBinding"
                      bindingConfiguration="custBind"
                      contract="WCF_SecureService.IService"&gt;
                  &lt;/endpoint&gt;
              &lt;/service&gt;
          &lt;/services&gt;
          &lt;bindings&gt;
        &lt;customBinding&gt;
          &lt;binding name="custBind"&gt;
            &lt;security authenticationMode="UserNameOverTransport"&gt;&lt;/security&gt;
            &lt;httpsTransport&gt;&lt;/httpsTransport&gt;
          &lt;/binding&gt;
        &lt;/customBinding&gt;
          &lt;/bindings&gt;
          &lt;behaviors&gt;
              &lt;serviceBehaviors&gt;
                  &lt;behavior  name="ServBehave"&gt;
                      &lt;serviceMetadata  httpsGetEnabled="True"/&gt;
                      &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
                      &lt;serviceCredentials&gt;
                          &lt;userNameAuthentication
                             userNamePasswordValidationMode="MembershipProvider" 
                      membershipProviderName="MySqlMembershipProvider"/&gt;
                      &lt;/serviceCredentials&gt;
                  &lt;/behavior&gt;
              &lt;/serviceBehaviors&gt;
          &lt;/behaviors&gt;
          &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt;
      &lt;/system.serviceModel&gt;
      &lt;system.webServer&gt;
          &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;/system.webServer&gt;  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Client config:</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;system.serviceModel&gt;
  &lt;bindings&gt;
      &lt;customBinding&gt;
          &lt;binding name="CustomBinding_IService"&gt;
              &lt;security authenticationMode="UserNameOverTransport" 
                          includeTimestamp="true"&gt;
                  &lt;secureConversationBootstrap /&gt;
              &lt;/security&gt;
              &lt;textMessageEncoding messageVersion="Default" 
                                      writeEncoding="utf-8" /&gt;
              &lt;httpsTransport maxReceivedMessageSize="2147483647" 
                              maxBufferSize="2147483647" /&gt;
          &lt;/binding&gt;
      &lt;/customBinding&gt;
  &lt;/bindings&gt;
  &lt;client&gt;
      &lt;endpoint 
          address="https://samsung/WCF40_SSL_Service/Service.svc"
          binding="customBinding" bindingConfiguration="CustomBinding_IService"
          contract="MyRef.IService" name="CustomBinding_IService" /&gt;
  &lt;/client&gt;
  
  &lt;/system.serviceModel&gt;
  
  &lt;/configuration&gt;
  </code></pre>