Friday, November 25, 2011

How to solve Siverlight application's 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?

An error occurred while trying to make a request to URI ‘http://localhost:<portnumber>/<ServiceAppName>/<serviceclassname>’. 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.

 When you call WCF Service using Silverlight you might receive the above error message.

 Here i am showing you how to solve this problem , which i have got so many times thanks to Chanmingman's blog from where i able to solve this.

The Steps to follow

1. Create an xml file using notepad and save as clientaccesspolicy.xml with the following content.

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

2. Create an xml file using notepad and save as crossdomain.xml with the following content.

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/>
</cross-domain-policy>

3. Copy these 2 files into web site root folder for example, c:\inetpub\wwwroot. for your IIS 

Cheers :)

 

Sunday, November 20, 2011

Why we use web.config transformation?

As I promised on my last post that i will describe what is web.config transformation is, but i did not get any reply for that. So this time I will describe why we use this we.config transformation.
As we  know in Microsoft Visual Studio we have two default Solution Configurations (Debug and Release) but do you realize we  have two different configuration for these two Solution Configurations, if you keep look on the web.config file you can see there are two config files for Debug and Release each
as Web.Debug.config and Web.Release.config.
Some times we add many connectionstring key  for different purpose i.e one for development purpose one for test one for live etc . But we are not using these two configuration files , why these are created? what the meaning of these?

Ok keep eye on my blog I will describe this on next week

Good Luck






Saturday, November 12, 2011

Do you know what is web.config transformation?

Do you know what is web.config transformation?
OK , let see how many answers i got. I will describe this next week ....:)