Calling SSL WCF Service from Silverlight
-
Whenever I call my SSL enabled webservice I get this message:
An error occurred while trying to make a request to URI 'https://XXXX.com/XXXX.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.
This service works with no crossdomain issues without SSL. I followed some online guide to enable SSL, which is to add a few lines in crossdomain policy file:
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*"/>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>Changing the web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SSLEnabled" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="XXXX.Web.XXXX">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="XXXX.Web.XXXXBehavior" name="XXXX.Web.XXXX">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="SSLEnabled" contract="XXXX.Web.XXXX" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>The host I am working on has multiple domain name so I had to add the following code in the WCF service:
Public Class
-
Whenever I call my SSL enabled webservice I get this message:
An error occurred while trying to make a request to URI 'https://XXXX.com/XXXX.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.
This service works with no crossdomain issues without SSL. I followed some online guide to enable SSL, which is to add a few lines in crossdomain policy file:
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*"/>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>Changing the web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SSLEnabled" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="XXXX.Web.XXXX">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="XXXX.Web.XXXXBehavior" name="XXXX.Web.XXXX">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="SSLEnabled" contract="XXXX.Web.XXXX" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>The host I am working on has multiple domain name so I had to add the following code in the WCF service:
Public Class
Hi there, I was getting the same message with an SSL enabled service recently. It turned out that the name on the certificate in IIS was slightly different than what I had in the WCF binding (I was missing a "companyname.co.nz" on my binding). It didn't really matter without SSL because it was all running locally so the machine-name (without the "companyname.co.nz") was enough. Something for you to double check anyway. Cheers.
-
Whenever I call my SSL enabled webservice I get this message:
An error occurred while trying to make a request to URI 'https://XXXX.com/XXXX.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.
This service works with no crossdomain issues without SSL. I followed some online guide to enable SSL, which is to add a few lines in crossdomain policy file:
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="http://*"/>
<domain uri="https://*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>Changing the web.config file:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SSLEnabled" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="XXXX.Web.XXXX">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="XXXX.Web.XXXXBehavior" name="XXXX.Web.XXXX">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="SSLEnabled" contract="XXXX.Web.XXXX" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>The host I am working on has multiple domain name so I had to add the following code in the WCF service:
Public Class
Also, if you're hosting on IIS, make sure there's an HTTPS binding on the site.
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Hi there, I was getting the same message with an SSL enabled service recently. It turned out that the name on the certificate in IIS was slightly different than what I had in the WCF binding (I was missing a "companyname.co.nz" on my binding). It didn't really matter without SSL because it was all running locally so the machine-name (without the "companyname.co.nz") was enough. Something for you to double check anyway. Cheers.
Thank you, it turns out everything was set up fine, but the Certificate itself was wrong. The host has fixed it and now the SSL service work fine.