Skip to main content
Home Forums Silverlight Programming Accessing Web Services with Silverlight WCF Service and https problem in silverlight
8 replies. Latest Post by Jonathan Shen – MSFT on November 3, 2009.
(0)
Navnee
Member
3 points
10 Posts
10-29-2009 1:45 AM |
Hi,
I am facing problems in consuming secure WCF service in Silverlight application, the WCF Service is running fine on http:// however if i try to consume it using https:// URI then it throws error.
<client /> <bindings> <basicHttpBinding> <binding name="basicHttpBinding"> </binding> <binding name="basicHttpsBinding"> <security mode="Transport"> <transport clientCredentialType ="None"/> </security> </binding> </basicHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="SessionServiceBehavior"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> <behavior name="ServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> <behavior name="AnnualizedRateOfReturnBehavior"> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </behaviors> <services> <service behaviorConfiguration="SessionServiceBehavior" name="SessionService"> <endpoint address="" binding="basicHttpBinding" contract="SessionService" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> <service behaviorConfiguration="AnnualizedRateOfReturnBehavior" name="AnnualizedRateOfReturn"> <endpoint address="" binding="basicHttpBinding" contract="AnnualizedRateOfReturn" /> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services>
here is the C# code
var WebService = new ServiceRef.SessionServiceClient("BasicHttpBinding_SessionService", Address.AbsoluteUri); WebService.ReturnSessionClassCompleted += new EventHandler(WebService_ReturnSessionClassCompleted);
However the if i run WCF service from Directly in browser. Both with http:// and https:// are running fine. means problem is in just consuming WCF service in Silverlight
Sergey.L...
Contributor
7256 points
1,354 Posts
10-29-2009 1:58 AM |
Do you pu a clientaccesspolicy.xml file to domain of WCF service. There are cross domain request from Silverlight application (http) to WCF service (https).Look Network Security Access Restrictions in Silverlight
10-29-2009 2:07 AM |
This is My ClientAccessPolicy.xml
<access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <domain uri="*"/> <domain uri="http://*"/> <domain uri="https://*"/> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy>
10-29-2009 2:23 AM |
Try this:
<access-policy> <cross-domain-access> <policy> <allow-from http-request-headers="*"> <domain uri="http://*"/> </allow-from> <grant-to> <resource path="/" include-subpaths="true"/> </grant-to> </policy> </cross-domain-access> </access-policy>
10-29-2009 2:33 AM |
Again Same problem, Silverlight application is working fine if i use http:// , its giving problem in https://
10-29-2009 2:56 AM |
Look with Fiddler tool at primary information about error.
Remark: it is not sniff requests over localhost
10-29-2009 6:46 AM |
It is showing Not Found error.
msalsbery
2056 points
379 Posts
11-01-2009 4:30 PM |
Navnee:if i try to consume it using https:// URI then it throws error.
I may be missing something, but I don't see where any of your endpoints are using the binding configured with transport security.
Are you missing a "bindingConfiguration="basicHttpsBinding"" on at least one of your endpoints?
Jonathan...
All-Star
24979 points
2,435 Posts
11-03-2009 4:05 AM |
Hi Navnee,
Please check Varshavmane's reply on your another post. Since this is a duplicate thread, we will mark it as "Resolved".
Best regards,
Jonathan