×

First time here?

You are looking at the most recent posts. You may also want to check out older archives. Please leave a comment, ask a question and consider subscribing to the latest posts via RSS or email. Thank you for visiting!

I’ve started a dialog with a few of you about getting Silverlight and service integration working, specifically with ASP.NET web services (and even WCF ones).  A few have downloaded some of my samples, but others have started from scratch.  A few have reported getting some interesting errors, ASYNC_blahblah and NotFound errors specifically.  While this was boggling my mind (as I wasn’t getting them), a reader’s comments pointed me along the lines of something…he mentioned “maybe it is because my web service is ASP.NET 2.0 and not 3.5” – of which that shouldn’t be the case, so I went to test that.

The Situation

Most of the samples you are likely seeing (including mine) are implementing web services within the same project that the Silverlight host is implementing.  What I mean to say is probably you are doing File…New…Silverlight Project and then incorporating the web service into the web site project that comes with that template.  If you do so, you probably aren’t running into problems.  Also note that the target framework of that default web site project is .NET 3.5.  This doesn’t make a difference, but I’m just noting it here.

But what if you have an existing service, or you have an existing web site project that you are running in Visual Studio and running into problems…and l think I know why…let’s investigate by doing this step-by-step.

The Web Service

First open an instance of Visual Studio 2008 and choose to create a new ASP.NET Web Service (I’m calling mine ‘FooService’).  Be sure to select .NET Framework 2.0 for this experiment:

Do nothing more to the service.  We’re just going to use the HelloWorld stub for this experiment.  We know we’re going to simulate a cross-domain situation so create a clientaccesspolicy.xml file at the root of this project.  You can use my snippet to do the default public policy quickly if you’d like, it’s wickedly cool and awesomely awesome.  I recommend it ;-).  Moving on… We are done here.  CTRL+F5 this bad boy to start it running (or select Service.asmx and view in browser) – we just need to get the service running.  Make note of the URL, it is likely http://localhost:XXXXX/FooService/Service.asmx where “XXXXX” is the random port assigned by VS.  Just note that URL.  Obviously if you didn’t call yours FooService, then it will be different.

The Silverlight Application

Start another instance of VS2008 and choose File…New…Project…Silverlight Application.  I’m calling mine FooApp.  Now, if you don’t see any of the Silverlight templates, just change the target framework back to .NET Framework 3.5 if you haven’t done so already.  Accept the default for creating the FooApp_Web project for you, we’ll need a host here anyway under HTTP.

Modify nothing in the Page.xaml file but add a service reference to the Silverlight application by right-clicking on the app and choosing ‘Add Service Reference.’  Put the URL of the ASP.NET 2.0 service (from previous step) in the box and click GO.  You should get it discovered and have ‘ServiceReference1’ as the name:

Just keep the lame name because we’re just playing around remember?  Now, go to Page.xaml.cs and add the following code:

public Page()
{
    InitializeComponent();
    Loaded += new RoutedEventHandler(Page_Loaded);
}

void Page_Loaded(object sender, RoutedEventArgs e)
{
    ServiceReference1.ServiceSoapClient proxy = new FooApp.ServiceReference1.ServiceSoapClient();
    proxy.HelloWorldCompleted += new EventHandler<FooApp.ServiceReference1.HelloWorldCompletedEventArgs>(proxy_HelloWorldCompleted);
    proxy.HelloWorldAsync();
}

void proxy_HelloWorldCompleted(object sender, FooApp.ServiceReference1.HelloWorldCompletedEventArgs e)
{
    try
    {
        TextBlock tb = new TextBlock();
        tb.Text = e.Result;
        LayoutRoot.Children.Add(tb);
    }
    catch (Exception ex)
    {
        string wtf = ex.Message;
    }
}

What we are doing here is calling the service (asynchronously of course) and wiring up the completion event to emit a new TextBlock with the result of the web service.  The Page() constructor just adds a Loaded event so we aren’t doing anything in the constructor to the XAML before it is done loading.

Okay, so we are done.  We have our web service with an appropriate clientaccesspolicy.xml file and it is running.  We have our Silverlight application with a service reference to that and proxy code generated.  We are using that proxy code to call the service, and use the result in a new TextBlock in our root layout element.  Sweet.  Put a breakpoint on the exception catch (should be line 37) and hit F5 (choose yes to enable debugging in web.config).

WTF?

Did you get ‘Async_ExceptionOccurred’ like I did?  Sonofa…  Maybe it is because I’m accessing an ASP.NET 2.0 service? No.  Maybe it is because my app is on port YYYY and my service is on port XXXX?  Nope.  Ah, cross-domain issues?  Try again.

Investigating the Problem

Okay, on to figuring out what is going on. 

If you are a web developer and you aren’t using an HTTP sniffing tool, shame on you.  This should be one of your biggest assets when doing web client development like Flash, Silverlight, AJAX, whatever.  For Microsoft developers there are usually 2 tools (both free) that come to the top: Fiddler and Web Development Helper.  I’m a HUGE fan of WebDevHelper (which I just noticed is on CodePlex now, cool Nikhil!) for 2 reasons.  First, it doesn’t require me to change my proxy settings or anything, which is a pain when using Fiddler and the built-in web server with VS because of the dynamic ports it uses.  Second, it is IN THE BROWSER!  I turn it on and I get an explorer bar at the bottom that shows me everything.  Me likey.

Ok, so using WebDevHelper I turn it on and spot the problem:

Spot it?  Remember our service was created on http://localhost:XXXX/FooService/Service.asmx?  If you read my previous post on cross-domain access (and soon a how-do-I video will be posted on this topic), you’ll note that the client access policy file must be at the ROOT of the service site. 

But Tim, it is!

Well, it is according to the file system, but look at the request Silverlight is making.  The problem here is the web development server in VS.  By default it not only grabs a random port, but also serves things up under a virtual directory (i.e., /FooService/Service.asmx instead of /Service.asmx).  So even though we have our policy file in the root, the web server isn’t treating our app like a root.  Notice the web service project properties:

The core problem was that it couldn’t find the clientaccesspolicy.xml file and thus denying the request to the service.

The Solution

For *this* scenario, the solution (or one of them, easiest in my opinion) is to change the service properties and just change the /FooService to “/” only.  This will restart the server for that project (browser to Service.asmx again just to make sure) and will then be operating under http://localhost:XXXX/Service.asmx

The next thing we need to do is go back to our Silverlight application and remove the service reference (as it is now invalid because the endpoint is no longer there).  Just select it and delete.  Choose ‘Add Service Reference’ again and point to the newly updated URL.  No need to change/delete the actual code in Page.xaml.cs because it will stay the same as long as you keep the SericeReference1 default name for this example.

Once you have that, F5 your Silverlight application again and you should see:

If we turn on WebDevHelper again we can see the policy file being requested and found, then the service call allowed through:

Again for this scenario (if you are playing around with Silverlight and just messing with services), this may be one of the issues you are running into.  A lot of the time cross-domain policy files may be the issue and that is why an HTTP sniffer is going to be your best friend to see what request is failing and why.  Even though this is an ASMX sample, if you were testing with a WCF service hosted in an ASPNET web site and running under VS2008 web development server, you'd likely run into the same issue.

Hope this helps!


4/10/2008 3:03 AM | # re: My Silverlight application cannot access my service!
I wish you could release this post about two months ago...I already learned how to fix this problems but your way could have been easier.
4/10/2008 8:03 AM | # re: My Silverlight application cannot access my service!
Good read, since we're talking webservices, I'm having serious trouble with WCF Services - let's use Jesse's WCF Service + LINQ tutorial to illustrate the case.

void Search_Click(object sender, RoutedEventArgs e)
{

ServiceReference1.Service1Client webService =
new SQLData.ServiceReference1.Service1Client();

webService.GetCustomersByLastNameCompleted +=
new EventHandler<SQLData.ServiceReference1.
GetCustomersByLastNameCompletedEventArgs>
(webService_GetCustomersByLastNameCompleted);


webService.GetCustomersByLastNameAsync(LastName.Text);
}

After running the debugger it turned out that :

ServiceReference1.Service1Client webService =
new SQLData.ServiceReference1.Service1Client();

is null and thus throwing an exception.

I believe I've managed to follow everything that was said in the tutorial but I fail to understand why this occurs. Your insight would be apreciated.

Sincirely.
Maciek
4/10/2008 8:32 AM | # re: My Silverlight application cannot access my service!
maciek: were you able to successfully add the service reference and it still is returning null?!
4/10/2008 6:47 PM | # re: My Silverlight application cannot access my service!
Super post. My Silverlight application is now accessing my Service.
Great stuff Tim.
4/11/2008 7:43 AM | # re: My Silverlight application cannot access my service!
spot on. silverlight app was not getting clientaccesspolicy.xml.
4/15/2008 8:56 PM | # re: My Silverlight application cannot access my service!
I would like to thank you for your large amount of work in explaining how to solve a difficult problem (albeit, it should be an easy one). I only wish I could get it to work for myself. I have built the FooApp and the FooService as described so eloquently. I have used the fooService address in the FooApp Service Reference and .cs. I have a single development computer with two instances of Visual Studio 2008 running each instance of FooApp and FooService. I have attempted a number of http address in setting up the ServiceReference to no avail. But the result is the same -- I end up with the cross-domain problem each and every time. Unfortunately the WebDevHelper shows no URL or status information as your images display. I am at a loss -- but will keep trying.

Thanks for your substantial effort...
4/15/2008 9:51 PM | # re: My Silverlight application cannot access my service!
chase: if you want to send me your solution i'll take a look
4/16/2008 8:18 PM | # re: My Silverlight application cannot access my service!
Tim,

I found that when I build the new project -- C# -- Silverlight Application -- and on the following page, allow the default "Web Site" as project type, none of the above works. It only works (for me) if I select project type of "Web Application Project." The project type of "Web Site" can cause hours of pulling hair out whereas, the project type "Web Application Project" can be running in 5 minutes or less. As well, the WebDevHelper could not return any URL's with "Web Site" project type whereas it worked perfectly with "Web Application Project" project type. So, if you have readers dismayed by all of this, it may be due to this simple difference.

Now I can see "Hello World"...seem like a trip around the world to get there...

Thanks for your help
4/16/2008 9:17 PM | # re: My Silverlight application cannot access my service!
chase: weird. i use web site projects exclusively and no problems with running or using webdev helper.
4/16/2008 9:24 PM | # re: My Silverlight application cannot access my service!
remember to open the web service project using Open Web Site or you won't be able to see the port/virtual root settings to change
4/17/2008 6:05 PM | # re: My Silverlight application cannot access my service!
Tim,
Did that...done that...Opened it under "Open Web Site..." ...changed virtual directory to / ...matched up ports on both FooApp and FooService... rebuilt the Service Reference...got rid of all temp files...rebuilt again... same error- "cross-domain"

Your directions are explicit and in detail. Now I just have to figure out how to get Silverlight to work under "Web Application Project" instead of "Web Project"...another set of problems.

Bruce
4/20/2008 9:45 AM | # re: My Silverlight application cannot access my service!
Tim,

I moved the development environment from Windows Server 2003 x64 to 32bit Windows XP Professional, and the example worked like a charm. I am convinced (albeit I would love to be proved wrong) that mixing web service, Silverligt and ASP.NET derived from "Web Site" (vs. "Web Site Application") option just does not work under x64.


chase
5/28/2008 1:35 PM | # re: My Silverlight application cannot access my service!
Tim,

I,ve tried your example but my problem is that my silverlight application won't let me add a service reference.

Do you know how to solve that?

Best regards
Chili
6/9/2008 3:24 AM | # re: My Silverlight application cannot access my service!
I tried out as you have written in your blog but i am still getting this error when i run the silverlight application:

An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code

Additional information: [UnexpectedHttpResponseCode]
Arguments:Not Found
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=2.0.30226.2&File=System.ServiceModel.dll&Key=UnexpectedHttpResponseCode

My web service is working fine...

Could you find a solution??
6/9/2008 7:57 AM | # re: My Silverlight application cannot access my service!
@Ajay: It sounds like you need a cross-domain policy file in place.
6/10/2008 12:15 AM | # re: My Silverlight application cannot access my service!
I have the crossdomainpolicy.xml file but i donot know where to put under which project The FOOAPP Silverlight host project or the WebApplication project which implements the Silverlight control...
6/10/2008 8:56 AM | # re: My Silverlight application cannot access my service!
@Ajay: you would put the policy file in the location where the SERVICE is being hosted -- the root of that domain.
6/11/2008 7:46 AM | # re: My Silverlight application cannot access my service!
Hi Tim,
My project structture is as follows. I have the service and the silverlight project in D: in folders silverlight and sampleservice.

I have made the sampleservice folder as the root and i have the clientaccesspolicy.xml and crossdomain.xml

I still getting the error

An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code

Additional information: The remote server returned an unexpected response: (404) Not Found.

As you have stated, i have places the clientaccesspolicy.xml and crossdomain.xml in the root of the service. I am not able to retrieve the response from the ASMX service.

Please let know what else should be done to get the response from the web service.

Kannan
6/11/2008 8:32 AM | # re: My Silverlight application cannot access my service!
@Kannan: have you used a tool like Web Dev Helper? See: http://timheuer.com/blog/archive/2008/06/10/silverlight-services-cross-domain-404-not-found.aspx
6/11/2008 9:02 PM | # re: My Silverlight application cannot access my service!
Yes i did use the web development helper tool. I was able to see the status of 404 when the xml files were not found. I placed the xml files in the root and when i ran the silverlight solution, i kept getting the error that i had mentioned in my previous post.
The web development helper screen is empty.

Kannan
6/11/2008 9:34 PM | # re: My Silverlight application cannot access my service!
@Kannan: even with the policy files in place are you seeing a 200 status request to them in web dev helper? and then the web service call fails? if you can send me a reproduction offline i can take a look. hard to troubleshoot with guessing at this point.
6/11/2008 9:47 PM | # re: My Silverlight application cannot access my service!
Hi Tim,
i see a success status of 200 in the web development helper logging screen. I have the images with me, but how can i upload them in this blog post, i am not sure. "Send me a reproduction offline", what does this mean? I am sorry i am not able to understand. I will send a mail of the images and may be a zip of the source code. Please let know what else i can do to get this resolved

Kannan
6/30/2008 1:15 AM | # re: My Silverlight application cannot access my service!
This all makes sense - but what if I do not have control over the service? I have the situation where I have to use a third party service - it has a crossdomain.xml file, but not in the root of the server - it is in the services root folder.
6/30/2008 8:54 AM | # re: My Silverlight application cannot access my service!
@Simon: For this version of Silverlight, the policy files must be in the root :-(
8/26/2008 9:25 PM | # re: My Silverlight application cannot access my service!
Hi!
I am getting some compile error as: "The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?) D:\SilverLight Practice Using VS\TestWCF\TestWS\Service References\ServiceReference2\Reference.cs". Give some solution to the above error
8/26/2008 9:26 PM | # re: My Silverlight application cannot access my service!
Hi!
I am getting some compile time error as: "The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?) D:\SilverLight Practice Using VS\TestWCF\TestWS\Service References\ServiceReference2\Reference.cs". Give some solution to the above error.
9/3/2008 7:15 PM | # re: My Silverlight application cannot access my service!
Thanks for the solution. What if I have a requirement that my web service must have virtual directory? What can I do in this case to allow Silverlight to access the web service?

Thanks
9/7/2008 2:42 PM | # re: My Silverlight application cannot access my service!
Bach: the cross domain policy files must be in the root...right now there is no other option.
9/9/2008 7:43 AM | # re: My Silverlight application cannot access my service!
I'm also getting the compile time error: "The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?)" :( Any ideas for a solution to this problem?
9/11/2008 12:17 AM | # re: My Silverlight application cannot access my service!
Better create a WCF service to access the web service you have and take that WCF service reference in ur silverlight Client.
9/12/2008 5:43 PM | # re: My Silverlight application cannot access my service!
- compile time error: "The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?)"

Does anybody know what causes this? The odd thing is, it started happening overnight with NO changes made to my code. Quite baffling really, as it was working yesterday...
9/12/2008 6:07 PM | # re: My Silverlight application cannot access my service!
- compile time error: "The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?)"

Ok, I've figured out the problem here. Silverlight doesn't support DataSet's, therefore if your service returns a DataSet type then it will result in the above error. (http://silverlight.net/forums/p/25270/89739.aspx)
9/19/2008 5:08 AM | # re: My Silverlight application cannot access my service!
Hi!
How about security when it comes to silverlight application? I have heard something called silverlight spy which can extract the details from the xap file of any silverlight application. What do you all think about this? I am trying to get more details about this.
9/20/2008 7:35 AM | # re: My Silverlight application cannot access my service!
Tim -

I am having no success getting the clientaccesspolicy.xml recognized ...

I am deploying my WFC-styled web service in IIS 7, separate from my silverlight application which calls the service (a simple hello world service) asynchronously. The service is deployed in my default web site, in a directory called Services. I've played no games with folders ... c:\inetpub\wwwroot\Services\HelloWorld\HelloWorld.svc is where the svc artifacts are. I can see wsdl, etc., as one would hope. The service uses a basicHttpBinding.

I have prepared a clientaccesspolicy.xml file, which I have located in wwwroot. It is wide open ... come from any direction, access any subfolders.

My Silverlight project contains a web service reference to this service.

I've ensured the reference is current ...

Execution of the service method call results in a failure ... System.Security.SecurityException ... InternalBeginGetResponse ... not sure if this is clientaccesspolicy.xml related, and I do not know exactly how to tell. I have installed WebDevelopmentHelper ... I get no insight regarding what is failing ... no log entries are captured ...

What advice could you give to me?

Thanks,
Tom

Gravatar
10/8/2008 7:48 AM | # re: My Silverlight application cannot access my service!
I created wcf services, which I got working fine with Silverlight. I then tried switching these services over to use https (Transport) security, to send secure messages between my server and client, but I was met with a System.Security.SecurityException.

I changed the binding in my web.config so that it looks like this:




I'm not sure whether or not to use "None", "Digest" or "Basic" here? I authenticate against Active Directory through a web form. (The app is will be running over the internet)
Gravatar
10/8/2008 7:50 AM | # re: My Silverlight application cannot access my service!
Sorry. It looks like this.
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
10/8/2008 8:18 AM | # re: My Silverlight application cannot access my service!
JD: If your Silverlight application is served in HTTP, but you are calling an HTTPS-based service, you will need a policy file at the service domain endpoint to allow non-secure callers. This is new to RC0.
10/9/2008 12:10 AM | # re: My Silverlight application cannot access my service!
After upgrading from SL2B2 to RC0 i can no longer get my WCF service to work on the production server, but it still works fine on the localhost setup. The weird thing is, i get no errors WHAT SO EVER. The only thing i can find out, is that the silverlight app fails on this line:

service = new ServiceClient(page.HttpBinding);

I have tried putting a cross domain file on the server, and there is no cross policy troubles. I simply dont know where to go from here, and i have been stuck with this problem for days now. Any ideas?
Gravatar
10/9/2008 2:15 AM | # re: My Silverlight application cannot access my service!
Tim: My application is hosted on HTTPS as well. According to this (channel9.msdn.com/.../Silverlight-Calling-HTTPS...) post by Mike Taulty, one cannot call a HTTPS service from an application that's hosted on HTTP even if policy files are present.

The actual problem I'm having is that I require a user to be logged in to access some methods in the service, so I placed the [PrincipalPermission(SecurityAction.Demand)] attribute tags above my methods. In the constructor of the service, I set Thread.CurrentPrincipal = HttpContext.Current.User, but I'm still met with a System.Security.SecurityException, telling me the that: "Request for principal permission failed." The service worked perfectly without HTTPS.
10/9/2008 9:46 AM | # re: My Silverlight application cannot access my service!
Rasmus: can you elaborate a bit more? Does the service still work? Have you looked at the traffic to see what the messages going back and forth are?

JD: Mike's information is now outdated. Beginning in RC0 you can have HTTP hosted applications call HTTPS services as long as there is a policy file at the HTTPS service root domain endpoint enabling it.
Gravatar
10/14/2008 11:54 AM | # re: My Silverlight application cannot access my service!
Nicely explained - good job.
Here is a problem I encountered and a possible explanation:
I just Added Service Reference to an existing Web Service and tried to compile. Thats all - nothing else. And I get this error:
"The type or namespace name 'schema' could not be found (are you missing a using directive or an assembly reference?) ".
After some research, figured out that the web service was had a signature of System.Data.Dataset GetData(){...}
Apparently, Silverlight does not know what a Dataset is and instead started using a temporary class called 'schema' (Check the Reference.cs file). Currently it seems like it is not possible to add System.Data as reference to Silverlight applications. Until then, we cannot use type of Dataset in any web service that you want consumed by Silverlight.
I think that is the explanation. As soon as I commented out the two methods that were returning Dataset type, the compile went through.
Hope this is of some help to those who may encounter this problem while trying playing around the concept outlined in this page by timheuer.
10/27/2008 2:58 PM | # re: My Silverlight application cannot access my service!
Tim, First off, love the blog and the information you post.

Ok, now that the wheels are greased I'm hitting a cross domain access issue.

I have an ASMX service hosted on a separate server. I can access the service locally i.e. LocalHost/Services/MyService.asmx?op=HelloWorld
and get a value back.
I can also access the service remotely i.e. http:\\myServiceIP\Services\MyService.asmx?op=HelloWorld and get a value back.

Per my previous dealings with SL and services I have added a clientaccesspolicy.xml to the root of the webserver. Following is the markup for that file
















I then have turned on network sniffing to see what's in the http going back and forth.

No 404 errors, only 200 status for files and the clientaccesspolicy file being passed back and forth.

Should be working right?

Nope.

On the AsyncResult method I get the following error:
"An error occurred while trying to make a request to URI 'http:\\myServiceIP\Services\MyService.asmx'. 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 unstable for SOAP services. ...."

What am I missing? Client access policy feels right, services seem to be set up right?

Thanks.
10/29/2008 5:42 AM | # re: My Silverlight application cannot access my service!
I had the exact same exception and everything, followed the instructions, yet still had the same problem.

Come to find out, if you use Linq to SQL classes and your relationships are not set so that the Parent property is set to Internal, the circular reference ends up causing this same error - it will let you consume the service, even call and run it, but when it calls the SendAsyncEnd it bombs.

I suspect that this may be evident on anything that causes a stack overflow/circular reference scenario during serialization of whatever you are returning from your service call.

I looked for hours and only after I switched to an asmx from a svc and found the handy Web Dev Helper did I figure this out - so this blog post helped me out substantially.
11/4/2008 12:36 AM | # re: My Silverlight application cannot access my service!
HI Tim

Tanx for the wonderful post.
i am sticking at one point... its making me gona mad...
i am tryin to consume a webservice developed in .Net 2.0 in my silverlight web application. i had included the cross domain policy xml file. now when i try to call my webservce i am getting the (404) error.
i am not geting out that where i am mistaken. please do help me out... i had followed al the steps that you had instructed....

Regards
Jimmie
11/4/2008 6:00 AM | # re: My Silverlight application cannot access my service!
Jimmie: Have you looked at your traffic to see where the traffic is going and what request is failing? See: timheuer.com/.../...ross-domain-404-not-found.aspx for some tools.
11/6/2008 3:03 AM | # re: My Silverlight application cannot access my service!
pingback: home.kbworks.nl/.../...ilverlight-application.aspx

i made use of your blog to make a silverlight application in sharepoint with wcf
11/13/2008 8:43 AM | # re: My Silverlight application cannot access my service!
I had the same problem than Matt Weyland, i looked at my logs and the last file accessed before the error was the clientaccesspolicy.xml it never go to the crossdomain.xml file always had the same error:"... 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 unstable for SOAP services. ...." The problem was that it need a cross domain policy for SOAP but the clientaccesspolicy file had nothing about SOAP in it so it didn't continu to see the crossdomain file


I just resolved my problem and here's how i fixed it:

I deleted the clientaccesspolicy.xml to leave only the crossdomain.xml that contains:

www.adobe.com/xml/dtds/cross-domain-policy.dtd">




11/13/2008 8:47 AM | # re: My Silverlight application cannot access my service!
Sorry, the crossdomain file didn't copy but this line is very important:
allow-http-request-headers-from domain="*" headers="SOAPAction"






11/14/2008 5:47 PM | # re: My Silverlight application cannot access my service!
G'day Tim,

Great work on your Silverlight services posts.

I'm having some troubles with mine.

I created a silverlight application that lists the files in a directory. I'm using a Silverlight-based WCF Service (the template). So my Web app contains the Silverlight based WCF service. That webservice returns a complex type. Locally (on my dev machine) the silverlight applications connects to the service and makes the call fine. However when I deploy to the server it fails. I thought it might be a privilege issue so I created a simple webform to list the files in a directory and it works, even on the server. So I assume my permissions on my folders on the server are correct, my call to the service works locally... I just don't understand why my service doesn't work on the server? Any thoughts...

Cheers,
12/14/2008 5:05 PM | # re: My Silverlight application cannot access my service!
I tried SOAP service sample code from silverlight.net samples.
and used clientaccesspolicy.xml file from Tim blog.

Running it still causes exception

System.ServiceModel.CommunicationException was unhandled by user code
Message="An error occurred while trying to make a request to URI 'http://localhost:1597/SimpleAsmx.asmx'. 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. Please see the inner exception for more details."
StackTrace:
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 WebServicesApp.SimpleASMX.SimpleAsmxSoapClient.SimpleAsmxSoapClientChannel.EndSayHelloToMe(IAsyncResult result)
at WebServicesApp.SimpleASMX.SimpleAsmxSoapClient.WebServicesApp.SimpleASMX.SimpleAsmxSoap.EndSayHelloToMe(IAsyncResult result)
at WebServicesApp.SimpleASMX.SimpleAsmxSoapClient.EndSayHelloToMe(IAsyncResult result)
at WebServicesApp.SimpleASMX.SimpleAsmxSoapClient.OnEndSayHelloToMe(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException: System.Security.SecurityException
Message=""
StackTrace:
at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
InnerException: System.Security.SecurityException
Message="Security error."
StackTrace:
at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState)
at System.Net.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState)
InnerException:


at line


WebServicesApp.SimpleASMX.SayHelloToMeResponse _result = ((WebServicesApp.SimpleASMX.SayHelloToMeResponse)(base.EndInvoke("SayHelloToMe", _args, result)));

How tox fix this ?
Gravatar
1/15/2009 7:55 AM | # re: My Silverlight application cannot access my service!
Hi Tim can you solve my problem?

I have my SL application : http://myserver/myvirtualdirapp/start.aspx
My asmx webservice: http://myserver:82/mywebservices/wyws.asmx

It works fine but I also want to access at my application
externally via VPN too

http://myserverVPN/myvirtualdirapp/start.aspx
http://myserverVPN:82/mywebservices/wyws.asmx

What can I do to configure both accesses?
I must use relative address for WebSerivce, somthing like this

EndpointAddress address = new EndpointAddress(
new Uri(Application.Current.Host.Source, "../mywebservices/wyws.asmx"));

or the WebSerivce is cross-domain and are not solution?
Appreciate your help. Thanks
1/15/2009 9:44 AM | # re: My Silverlight application cannot access my service!
Andrus you need to ensure the *web* project is the starting project. You are hitting a cross-scheme violation.
1/15/2009 9:45 AM | # re: My Silverlight application cannot access my service!
GL you'll need to have a clientaccesspolicy.xml file in place at myservervpn:82/clientaccesspolicy.xml to allow the callers.
Gravatar
1/16/2009 2:29 AM | # re: My Silverlight application cannot access my service!
Hi Tim thanks for your help but I have some trouble.
I haven't a server myserverVPN, i have only a router that solve
the server name.

myserverVPN -> router -> myserver

[ie 208.77.188.166 -> router -> 10.176.164.01]

so i think i can't use your solution (note that i have myserver:82/clientaccesspolicy.xml).

The problem is that if i access at my app internally in my domain with
http://myserver/myvirtualdirapp/start.aspx
and the call at web service is
EndpointAddress address = new EndpointAddress(
new Uri(http://myserver:82/mywebservices/wyws.asmx);
it works but when i access at my app externally with
http://myserverVPN/myvirtualdirapp/start.aspx
then the call at web service fail.

You said yes it is correct that fail cause de client can't access at myserver:82/mywebservices/wyws.asmx.
So if i change endpoint like
EndpointAddress address = new EndpointAddress(
new Uri(http://myserverVPN:82/mywebservices/wyws.asmx);

externally i can work with the app but internally i can't solve myserverVPN:82/mywebservices/wyws.asmx
name and the call fail.

So what can i do to dynamically solve the calling webservice name when access at my application internally and externally?

I think at this solution but really i don't like it

Uri BaseUri = new Uri(System.Windows.Browser.HtmlPage.Document.DocumentUri.AbsoluteUri);
string[] URIparts = System.Windows.Browser.HtmlPage.Document.DocumentUri.AbsoluteUri.Split('/');
string epaddress = URIparts[0]+"//"+URIparts[2]+":82/mywebservices/wyws.asmx";
EndpointAddress address = new System.ServiceModel.EndpointAddress(epaddress);

Thanks again
GL
1/16/2009 10:14 AM | # re: My Silverlight application cannot access my service!
GL now I understand! Yes, you'll have to implement a solution in your code to specify the endpoint if the endpoint essentially changes based on the environment.
1/17/2009 8:41 AM | # re: My Silverlight application cannot access my service!
Hi,

What do you do when your WCF service is hosted as a windows service? or can you not use a windows service to host a wcf service that uses basicHttpBinding?


Thanks,

Argneka

1/18/2009 2:02 PM | # re: My Silverlight application cannot access my service!
Argneka look at Carlos' blog post here for the basic concept - blogs.msdn.com/.../...elf-hosted-web-services.aspx
Gravatar
1/19/2009 2:00 AM | # re: My Silverlight application cannot access my service!
Hi Tim with your help I found the solution at laumania.net/.../...service-in-Silverlight-20.aspx

Thanks

GL
1/20/2009 1:06 AM | # re: My Silverlight application cannot access my service!
"An error occurred while trying to make a request to URI 'localhost/InformRxService/InformRxService.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. Please see the inner exception for more details."

I am getting this error while accessing my hosted WCF service with LINQ. When I cheked the error details, It is related to the "Security error". How can i fix this issue. I have placed the Crossdomain policy file in the right place..

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "www.macromedia.com/.../...ain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

- This is the cross domain policy file which i have used/placed in my root folder path..

Please guide to fix this issue..
Gravatar
1/20/2009 3:51 AM | # re: My Silverlight application cannot access my service!
Hi Tim, its me again.
Now I have a new problem with clientaccesspolicy and I can't found the solution.
Well,I have my SL application and my asmx webservice as

http://localhost/myapp/start.aspx
http://myserver:82/mywebservices/wyws.asmx

and the clientaccesspolicy.xml put into wwwroot on myserver (i can locate it http://myserver:82/clientaccesspolicy.xml)

<resource path="/mywebservices" include-subpaths="true"/>

It works fine but when i try to call another webservice (same server but different port)

http://myserver/Timwebservices/Timws.asmx

i can't locate the clientaccesspolicy file, http://myserver/clientaccesspolicy.xml ,
it return HTTP403 error (not 404)

I try to add

<resource path="/Timwebservices" include-subpaths="true"/>

and change the permission to the file but without result.

GL
1/20/2009 6:42 AM | # re: My Silverlight application cannot access my service!
Sankar for solving issues like this you really need to debug with a tool like Web Deveopment Helper or Fiddler to see what the traffic is really saying. Look at the requests/responses and see what is making it, what isn't and what the contents are.
1/20/2009 6:46 AM | # re: My Silverlight application cannot access my service!
GL I'm not sure what is going on and would have to look at the traffic. A 403 definitely is an indication of some permission issues as you note though.
Gravatar
1/20/2009 8:15 AM | # re: My Silverlight application cannot access my service!
Hi Tim, this is the traffic to my app sniffing with Fiddler

Result Host URL Body
200 localhost:1247 /myAppTestPage.aspx 3.149
200 localhost:1247 /ClientBin/myAppTestPage.xap 3.328.21
304 myserver:82 /clientaccesspolicy.xml 0
200 myserver:82 /mywebservices/wyws.asmx 950
200 myserver:82 /mywebservices/wyws.asmx 950
200 myserver:82 /mywebservices/wyws.asmx 39.104
200 myserver:82 /mywebservices/wyws.asmx 318.499
403 myserver /clientaccesspolicy.xml 1.529
403 myserver /crossdomain.xml 1.529
Gravatar
1/20/2009 8:51 AM | # re: My Silverlight application cannot access my service!
Hi Tim finally I solve my problem.
It was a strange configuration on IIS server
Gravatar
2/5/2009 9:14 AM | # re: My Silverlight application cannot access my service!
GL - How did you solve the problem. I have the same issue?
2/5/2009 1:18 PM | # re: My Silverlight application cannot access my service!
Hi Tim,

Your work is great - thanks so much.

I'm so close, but I can't get this to work. I have done everything you said, including the sniffer. I have an asmx web svc on an assgd port (5580), and I have placed the clientaccesspolicy file in its root. The sniffer tells me it can find it:

http://localhost:5580/clientaccesspolicy.xml 200

But I still get this exception at the (perfectly named) wtf breakpoint:

An error occurred while trying to make a request to URI 'http://localhost:5580/mossasmxsvc.asmx'. This could be due to attempting to access a service in a cross-domain way without a proper cross-domain policy in place, [...]

The inner exceptions are InnerException: System.Security.SecurityException.

I have a very simple HelloWorld returning a simple string. Well, at least in the browser. Not yet in Silverlight.

May I please ask what I might be missing or should double-check?

My cap.xml file reads (brackets removed) as follows:

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

I've also got it in inetpub\wwwroot.

Help, please?!

Thanks and keep up the excellent work.

2/6/2009 10:52 AM | # re: My Silverlight application cannot access my service!
Um, uh, ummmmm... I hadn't updated a service reference and, um, uh, um,

IT WORKS NOW! THANKS, TIM!

Time to open a bottle of wine to celebrate!



Gravatar
2/10/2009 7:29 AM | # re: My Silverlight application cannot access my service!
Hi Dan, I had simply reconfigured the virtual directory's properties on IIS.
Hope this help.

GL
3/3/2009 7:44 AM | # re: My Silverlight application cannot access my service!
Any idea if Microsoft has any plans to change this method of requiring the client access policy on the service? If a web service is willing to supply data, but does not have client access policy in the root, Silverlight should assume that it has full and complete access.

Otherwise, in the situation where the developer has no control over the web service, Microsoft is just requiring that the developer do more work (write a proxy for the uncontrolled web service). It accomplishes nothing other than making life more difficult for the developer.

The current design makes absolutely no sense to me. Am I missing something as to the reasoning for this requirement?
3/3/2009 8:58 AM | # re: My Silverlight application cannot access my service!
Jonathan it really gets down to cross-site-scripting and reducing the attack surface. Web applications (and RIA apps) operate in a sandboxed, low-trust environment in the browser. The policy files are nothing new to RIA development and in fact the concept was started by Adobe to solve the problem of cross-site scripting attack surfaces. Here's some more explanation: scorbs.com/.../silverlight-http-networking-stac...
3/18/2009 1:28 PM | # re: My Silverlight application cannot access my service!
Tim:

The problem is that when I run the Silverlight control by itself in Visual Studio, OR directly from my ASP.NET app in IIS ON the app server (not my local machine) it works perfectly without error. However, when I call my ASP.NET app via IP address from my local machine, my Silverlight 2 UserControl that is imbedded on the ASP.NET page throws the following exception.

"An error occurred while trying to make a request to URI 'http://WCFServices/MySilverlightService.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 contanct the owner of the service to publish a cross-domain policy file and to ensure it allows SOAP-related HTTP headers to be sent. Please see the inner exception for more details. Inner Exception: System.Security.SecurityException ---> System.Security.SecurityException: Security error."

Now when using Fiddler to see the traffic for a Silverlight UserControl that is compiled into a .xap referenced by an ASP.NET app, you only get the following entry (which basically states that the .xap was found):

304 HTTP /MyAPNETProject/Silverlight/MySilverLightControl.xap

When I debug the Silverlight 2 control separately in VS.NET, I then do get the more granular detail as below:

200 HTTP /clientaccesspolicy.xml

200 HTTP /MySilverlightService.svc

I have both 'clientaccesspolicy.xml' & 'crossdomain.xml' in the WCF project root, the ASP.NET app project root, and the Silverlight folder root within the ASP.NET app where the .xap is located as well. I know they are not required in all of those places, but I wanted to make sure I am not missing anything.

Obviously I am still missing something though, because my WCF calls from my Silverlight control fail ONLY when being called through the ASP.NET via the IP address of the website.

Do you have any insight as to what I may be doing incorrectly still?

Thanks for your help, I really do appreciate it!
3/23/2009 6:03 AM | # re: My Silverlight application cannot access my service!
atconway: when you use a sniffer -- what is the detail of the exception that happens? look at the actual HTTP response.
3/27/2009 5:59 AM | # re: My Silverlight application cannot access my service!
Hi Tim,

Thanks for this article.

However after following all the steps :

1. changing the virtual root to '/'
2. adding a clientaccesspolicy.xml and eventually a crossdomain.xml file aswell.
3. deleting and updating my service reference
4. recieving a status '200' on the web development helper util for the clientaccesspolicy.xml file

I still got the same result.

Let me give you an idea of my setup :

1. Silverlight Application hosting my silverlight application
2. A seperate asp.net application hosting my WCF service.


After some googling I came accross this article : blog.donnfelker.com/.../...Cross-Domain-Issue.aspx

My silverlight application was making use of the default TestPage.html page to test my silverlight app against. This as you know is a configuration option when the Silverlight application is created (Add a new ASP.NET web project... OR Automatically generate a test page..), I went with the latter.

The test page(or the configuration to run the app from a dynamically generated html file) messed with the silverlight app's ability to successfully call the WCF service.

My solution (I'm sure there should be some other way to correct this?):

All I did was create a seperate ASP.Net application, added a ClientBin folder, copied the SLApp.xap file generated by the silverlight app into that directory and dragged a silverlight control onto the default.aspx page and pointed it to my silverlight applications xap file : Source="~/ClientBin/SLApp.xap".

TADA! hope it helps.

Pieter


3/27/2009 11:05 AM | # re: My Silverlight application cannot access my service!
Hi Tim-

I posted a comment with details, and the site replied that it needed to be moderated because it was marked as SPAM. If you do not get it let me know, and I can repost it. It may have been caused because I pasted in some of my info and it may of contained tags or something.

Thank you for your help!
3/27/2009 11:20 AM | # re: My Silverlight application cannot access my service!
atconway -- in Fiddler you want to look at the Raw or Text response in the inspecter viewer of the application.
3/30/2009 11:48 AM | # re: My Silverlight application cannot access my service!
Here is the Raw output from the MySilverlightControl.xap response:

Top half of Fiddler Raw screen:

GET /Silverlight/MySilverlightControl.xap HTTP/1.1
Accept: */*
UA-CPU: x86
Accept-Encoding: gzip, deflate
If-Modified-Since: Mon, 23 Mar 2009 14:41:08 GMT
If-None-Match: "d6c72e67c5abc91:1a54"
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618; InfoPath.1; .NET CLR 1.1.4322)
Host: 111.222.3.444
Connection: Keep-Alive
Cookie: ASP.NET_SessionId=hj4ur4ahiimxilvd1ua2mtuu

Bottom half of Fiddler Raw screen:

HTTP/1.1 304 Not Modified
Last-Modified: Mon, 23 Mar 2009 14:41:08 GMT
Accept-Ranges: bytes
ETag: "d6c72e67c5abc91:1a54"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Mon, 30 Mar 2009 18:43:33 GMT
3/30/2009 11:50 AM | # re: My Silverlight application cannot access my service!
atconway you'll have to look more at the service requests -- this is just the XAP request. Execute a function that attempts a service call and start looking at that traffic.
3/30/2009 12:21 PM | # re: My Silverlight application cannot access my service!
Yeah, Fiddler does not show any traffic to the WCF service calls from the Silverlight control once the .xap is consumed by the ASP.NET app; or at least with mine it is not showing any response traffic other than just finding the .xap.

If I run Fiddler against a test harness run locally (localhost via IDE dev server) of the Silverlight control I do get a WCF response for the following: (304 MySilverlightService)

Raw Top of screen:

GET /clientaccesspolicy.xml HTTP/1.1
Accept: */*
UA-CPU: x86
Accept-Encoding: gzip, deflate
If-Modified-Since: Wed, 25 Feb 2009 16:16:32 GMT
If-None-Match: "030ed6b6497c91:a24"
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618; InfoPath.1; .NET CLR 1.1.4322)
Host: MySilverlightService
Connection: Keep-Alive

Bottom:

HTTP/1.1 304 Not Modified
Last-Modified: Wed, 25 Feb 2009 16:16:32 GMT
Accept-Ranges: bytes
ETag: "030ed6b6497c91:a24"
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Date: Mon, 30 Mar 2009 19:14:51 GMT
3/30/2009 12:54 PM | # re: My Silverlight application cannot access my service!
atconway - hmmm, when you run your application other than the local host, is it running under HTTP or does the address bar use the file system? Hard for me to debug without being at the environment at this point.
3/30/2009 1:13 PM | # re: My Silverlight application cannot access my service!
I run under HTTP: For example I will pull my site up by 111.222.3.444/MyAspNetApplication/Default.aspx

HTTP is when it does not work. It only works when I pull up the site via localhost and run it under the VS.NET 2008 IDE dev server. I get the same unwanted result even when I run my web app directly from IIS on the web server.

By the way, I thought I was on to something but it did not pan out. I noticed in fiddler when I pulled up http://MyWebServer/CrossDomain.xml the following response:

Moved Permanently: The document has moved... "www.adobe.com/.../cross-domain-policy.dtd"

I had "www.macromedia.com/.../...-domain-policy.dtd". I was so excited because I thought that might some how magically do it, but after updating the 5-10 crossdomain.xml files I have sprinkled all over the server (I have so many just to make sure that is not the issue), it still didn't work and the result is the same.

Unless the error message is masking something else, it has to be something with the crossdomain.xml file right? I just don't understand what it could be.
3/30/2009 1:48 PM | # re: My Silverlight application cannot access my service!
atconway -- for Silverlight you should use clientaccesspolicy.xml as your default format. We don't control the format for crossdomain.xml and therefore only support one path of it's use. I wish I can help more, but it is hard without seeing what is happening.

If your host application is at foo.com and the XAP is calling a service at someothersite.com then the policy file must be at the ROOT of someothersite.com with the necessary information to allow communications. You can try putting explicit bindings in your Silverlight application and/or changing the ServiceReferences.clientconfig to be the desired host name that you want.

Sorry, at this point I'm grasping at straws without seeing the action happen.
3/30/2009 2:09 PM | # re: My Silverlight application cannot access my service!
Thanks Tim for trying, I really do appreciate your help. I have a the 'clientaccesspolicy.xml' at the root of someothersite.com (where the WCF service sits) and it successfully get accessed when I pull my site up locally; I can see this in Fiddler. I don't even see it being attempted to be accessed when called by opening the web that is deployed on the server (via http).

Well I have about 3 weeks to figure this out so wish me luck. I know there has to be a solution because it does work... just not all of the time in all scenarios :|

3/30/2009 2:14 PM | # re: My Silverlight application cannot access my service!
atconway - one thing that comes to mind is that make sure the .clientconfig in your silverlight application is using a name that will be accessible from the client machine. It's possible that no request is being made because it can't even find the domain name.
4/2/2009 6:41 AM | # re: My Silverlight application cannot access my service!
Tim- Here is one other piece of info that may help: When I publish my ASP.NET site up to the test server, and then run the site from IIS on the server the Silverlight WCF calls work perfectly! When pulled up it shows the URL as http://111.222.3.444/Pages/Default.aspx.

When I go back to my machine, off the web server, and pull up that same URL the silverlight shows the crossdomain error.

On the server, Fiddler finds '/clientaccesspolicy.xml' and everything works! On the client, Fiddler doesn't even show the app looking for the clientaccesspolicy file. Does this go in line with your last post?
4/2/2009 8:46 AM | # re: My Silverlight application cannot access my service!
I JUST FIGURED IT OUT!! (or got it working, which ever is more appropriate). As my posts have eluded to before, this ASP.NET site is in a corporate environment on an Active Domain directory. In IIS we use 'Integrated Windows authentication'. What this provides is once a DNS is registered for the site's IP, then the user is NOT prompted for a login; this is because the DNS is registered on the domain and their is a trust. With AD passing the user's credentials in the background the user never sees a login when accessing http://MyCorporateSite (even though thier is group security on the web servers folder). However, prior to a DNS registration of the site when it is pulled up via IP, the site (IE) will prompt the client for their crentials.

...To bring this full circle, all of the issues to this point have been testing the site via the IP which prompted me for credentials when pulling up the site. My best guess is that when pulling up the site in that manner, the credenitals are not passed along to the Silverlight control and therfore there is no trust, and the WCF calls could not be made. Once I got the DNS registered, and accessing the site would NOT prompt for credentials, EUREKA! the Silverlight control display's with no problem.

The difficulty here is that I typically do not request a DNS registry for an IP of a project on our test server. I ususally only do that with a production site. Being new to Silverlight, I didn't think that could ever be an issue. I already had a DNS registered for the WCF service, but that was not the party at fault here, it was the ASP.NET site hosting the Silverlight .xap control.

This was so difficult to solve to, because so many examples I searched for always present solutions working through 'localhost'. My apps difficulties were not apparent until setting up in a corporate style setup.

Tim, maybe you can address another way the Silverlight control could have worked by pulling up the site via IP. That may still be helpful, especially for users that can not get the DNS registered right away from thier networking group.

I hope this helps somebody in the future. Thanks again Tim for helping me to degug this issue.
4/7/2009 1:10 AM | # re: My Silverlight application cannot access my service!
Hi Tim
I am using silverlight application in Dynamic Data website. When i run it in visual studio 2008, it runs fine, but when i put it in Virtual Directory is gives the cross domain error and obviously it doesnt fetch data. I have crossdomain.xml and clientaccesspolicy.xml both in the application. Can you please tell me what could be the possible reason for this. If you need to have a look at the code, I can send you the code
Thanks in anticipation
4/7/2009 5:46 AM | # re: My Silverlight application cannot access my service!
Hi Tim,

I think I am facing the same problem which you have mentioned above. The status of service is 404 and path which it is using is http://localhost/crossdomain.xml" title="http://localhost/crossdomain.xml">http://localhost/crossdomain.xml and http://localhost/clientaccesspolicy.xml" title="http://localhost/clientaccesspolicy.xml">http://localhost/clientaccesspolicy.xml which is wrong. It needs to be http://localhost/[VirtualDirectoryName]/crossdomain.xml

I am able to add service reference to my silverlight application. I am not facing any issue with that/
I am using WCF services and I am not able to understand how to rectify it. Please help

Thanks in anticipation
4/7/2009 7:27 AM | # re: My Silverlight application cannot access my service!
Jatinder -- no your app is wrong :-) -- the policy file (please use clientaccesspolicy.xml if you are using Silverlight -- there is no need to have both) needs to be at the ROOT of the site, not the root of the application. The request to the policy file is correct.
4/30/2009 12:16 PM | # re: My Silverlight application cannot access my service!
Tim,

This was a great article, it helped me fix one of my issues. The one remaining issue is similar to this, I want to now have a project1 load my project2 (Silverlight project) and be able to pull data from the database. I am referrencing the xap file like this...

<asp:Silverlight ID="Xaml4" runat="server" InitParameters="ControlID=Page" Source="/pathname/Alerts.xap" MinimumVersion="2.0.31005.0" Width="100%" Height="100%" />

and it is able to open it but is not able to get the data. I am thinking because it is not running the service from the Silverlight project. How do I make that happen?
4/30/2009 12:19 PM | # re: My Silverlight application cannot access my service!
I am pretty sure this has to do with this line in the ServiceReferences.ClientConfig file:

<endpoint address="http://localhost:4878/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="ServiceReferenceAlerts.IService1"
name="BasicHttpBinding_IService1" />

Because this is a temporary port number (4878) but I am not sure how to change it.
4/30/2009 12:43 PM | # re: My Silverlight application cannot access my service!
Tim you can change the URI in the client config itself to match what you need.
5/1/2009 2:01 PM | # re: My Silverlight application cannot access my service!
Hi - Great Post.

I have confirmed with the Webdevhelper tool that I am getting 200 response when accessing the clientaccesspolicy file

however now i get the following exception when debugging in VS. No errors show in the webdevhelper toolbar after the 200 response.

something not quite right with my webservice? i have updated the reference.

any ideas??

System.ServiceModel.CommunicationException was unhandled by user code
Message="The remote server returned an error: NotFound"
StackTrace:
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 CrmSilverlightDirect.CrmSdk.CrmServiceSoapClient.CrmServiceSoapClientChannel.EndExecute(IAsyncResult result)
at CrmSilverlightDirect.CrmSdk.CrmServiceSoapClient.CrmSilverlightDirect.CrmSdk.CrmServiceSoap.EndExecute(IAsyncResult result)
at CrmSilverlightDirect.CrmSdk.CrmServiceSoapClient.OnEndExecute(IAsyncResult result)
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)
InnerException: System.Net.WebException
Message="The remote server returned an error: NotFound"
StackTrace:
at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
InnerException: System.Net.WebException
Message="The remote server returned an error: NotFound"
StackTrace:
at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
InnerException:
5/1/2009 2:12 PM | # re: My Silverlight application cannot access my service!
Hi Tim

Sorry I should add that the project I am working on is a CRM & Silverlight one I downloaded from MSDN so the issue might be a bit more complex.

I will try your simple project 1st then maybe re-tackle the CRM one :)

But any insights you might have would be greatly appreciated regardless
5/9/2009 1:39 PM | # re: My Silverlight application cannot access my service!
Hello Tim,

I have created a web service http://localhost/RetailService/WebService.asmx and have referenced it in my silverlight project. When i run my silverlight app as
http://localhost/Retail/default.aspx, everything works fine for me... but when i try accessing it using my machine name say http://dpsajr/Retail/default.aspx then i get a cross domain policy error. The details of the Cross domain policy are as under:

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE cross-domain-policy SYSTEM "www.macromedia.com/.../...ain-policy.dtd">
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
</cross-domain-policy>

and the details of the Client Access Policy are :
<?xml version="1.0" encoding="utf-8" ?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>


Also how im refereing my webservice in the app is:

// This value is read from the config file.
liveSearchUri = "dpsajrtcs/RetailService/WebService.asmx";
BasicHttpBinding binding = new BasicHttpBinding();
EndpointAddress endPointAddress = new EndpointAddress(liveSearchUri);
BigFishWebServiceSoapClient client = new BigFishWebServiceSoapClient(binding, endPointAddress);
client.SearchQueryCompleted += new EventHandler<SearchQueryCompletedEventArgs>(client_SearchQueryCompleted);
client.SearchQueryAsync(word, 50, webQueryOffSet);

Please can you help me with this.
5/10/2009 11:05 AM | # re: My Silverlight application cannot access my service!
a Correction to the above post... the value of liveSearchUri is
liveSearchUri = "dpsajr/RetailService/WebService.asmx";
5/10/2009 1:38 PM | # re: My Silverlight application cannot access my service!
Hi;

My environment:
xp64 pro
VS 2008 sp1
SL 2.0

WCF service part of web site host
using L2S as the data source

Hello World works fine. (simple string)

Returnig a "System.Collections.Generic.List(Of tblBranch)" does not with a 'Not Found' error. (name tblBranch is from a legacy DB...I didn't name it that :) )

The contract is there....all seems like it should work. I step through the service, the data is populated and the populated List is returned (or appears to be)

The function "Public Function EndGetBranches(ByVal result As System.IAsyncResult) As System.Collections.ObjectModel.ObservableCollection(Of PPCServices.tblBranch) Implements PPCServices.Service1.EndGetBranches" is not returning a valid list in the result. Just the rrror.

Somewhere along the line there must be a type mismatch of some kind. Just cant find it.

Ibrahim



5/24/2009 1:39 PM | # re: My Silverlight application cannot access my service!
Ibrahim - regarding "NotFound" errors -- make sure you look at the network traffic and the actual response for the error from the service.
5/24/2009 1:46 PM | # re: My Silverlight application cannot access my service!
Mark Lloyd - if you look at the traffic after the cap.xml file is accessed, are the service calls being made? Sniff the traffic...right now it is more helpful than the errors.
7/23/2009 3:08 PM | # re: My Silverlight application cannot access my service!
Tim

Many thanks for your post. I have been battling with this issue for weeks. After months of learning WPF, WCF, LINQ and then Silverlight this problem stopped me dead in the water. I was going to give up on Silverlight.

"Simple" problems like this make productivity with Microsoft tools very slow.

Once again many thanks.

Gravatar
8/9/2009 10:03 PM | # re: My Silverlight application cannot access my service!
...by God man... this saved me from putting a fist through my monitor...stuggled for hours with this issue. Thanks for the post!!!
8/19/2009 3:16 PM | # re: My Silverlight application cannot access my service!
FWIW, I managed to solve the cross-domain issue by placing this clientaccesspolicy.xml in my website root. The key idea is that I had to have the line for the SOAPAction.

Note, I removed the greater-than and less-than signs so that it'll show up in the comment; just place them back in the beginning and end of each line:

?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 include-subpaths="true" path="/"/
/grant-to
/policy
/cross-domain-access
/access-policy



9/2/2009 7:56 AM | # How to force WCF to re-get crossdomai.xml?
Hi Tim,
I had the same problem as many others - I could not get my Sliverlight client working with my self-hosted WCF service. Thanks to your blog it started working.

But it only works if the service is already running when the SL client starts up.
If the service is not available at the time the client tries to call its first method (and gets the crossdomain.xml missing exception), it is not able to recover even if the service becomes available.

The only way seems to be refreshing the IE. Is there a way to force WCF to re-get the crossdomain.xml file?
9/2/2009 8:15 AM | # re: My Silverlight application cannot access my service!
janburian - you can't programatically force the x-domain file. The app has to be reloaded (i.e., page refresh).
9/18/2009 8:31 AM | # re: My Silverlight application cannot access my service!
Tim,

I am also having cross-domain policy issues. I placed both my created clientaccesspolicy.xml and crossdomain.xml files in the root directory, but I am getting an HTTP 502 error whether the files are located in the directory or not. I've scoured trying to find a solution, but I'm not sure what to do.
Fiddler2 states in the error that "No connection could be made because the target machine actively refused it".

Any thoughts?
9/18/2009 9:38 AM | # re: My Silverlight application cannot access my service!
Tim,

I thought I should clarify a few things.

I am running a Silverlight/WCF website. I am trying to debug why WCF keeps failing with a "The remote server returned an error: NotFound." when I am running a SQL statement. Thus, I am trying to setup my project to allow Fiddler to debug why I'm getting this error.

I have followed many tutorials outlining how to setup my clientaccesspolicy.xml file. However, Fiddler gives me an HTTP error 502 and VS 2008 tells me I have cross-domain policy problems. I am running this locally.

Thanks in advance for any help you can offer!
10/11/2009 11:35 PM | # re: My Silverlight application cannot access my service!
Tim,
Great work as always!

I was having this problem but with a WCF service and having everything in the same application. The error was:

Additional information: An error occurred while trying to make a request to URI 'http://example.org:7001/beans/TestWebServiceBean'. 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...

I tried all kinds of things and eventually deleting the service reference and adding it back worked.

Just throwing that out there for anyone who might be pulling their hair out too.
10/21/2009 10:00 AM | # re: My Silverlight application cannot access my service!
After 2 days of crashing my head and keyboard, reading forums, finally figured it was the size of the result set I get back was causing "The remote server returned an unexpected response: (404) Not Found." error. I was a table with about 30 columns (including free text) and more than 2000 records spits out this message too. The SL enabled WCF service returned rows all time but it was not reaching the client in full. However returning less records in my case worked.

This is not a perm solution, at the least I figured the problem. Any suggestion to overcome this will be greatly appreciated.
11/17/2009 6:10 AM | # re: My Silverlight application cannot access my service!
Tim,

Perhaps you may be able to offer some advice here.

I have a silverlight 3 application which is attempting to communicate with a WCF service which is being hosted as a windows service.

The WCF service was originally created using the silverlight enabled wcf service project but I have changed the binding from http to web because I want to communicate with the service using the WebClient's UploadStringAsynch to perform a simple http post.

When accessing the service via fiddler all is fine. When attempting to access it from inside sivlerlight via a web client I get (via the UploadStringCompleted event) the System.Security.SecurityException (at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState))

This I assume is the cross domain policy issue raising it's head. Unfortunately neither fiddler not WebDevHelper pick up on the http requests being sent out (not used the tools in anger before so could be my set up). Tested as similar a situation as I could think of using the WebClient methoiod to do a post to a web page which worked absolutely fine.

Do you have any suggestions as to what to look into or try next?

Kind Regards

Raine

11/19/2009 5:11 AM | # re: My Silverlight application cannot access my service!
Hi Tim,
Great day!
I have seen all the threads and mine is totally a different one.
Actually my service is a jax-ws web service deployed in Tomcat server and this service is referenced by Silverlight client.

when i run the client the cross domain error that is "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. Please see the inner exception for more details."

Where should i put the clientaccesspolicy.xml?
Should i use crossdomain.xml also?

please suggest on this
11/25/2009 9:08 AM | # re: My Silverlight application cannot access my service!
Hi. I got the same error, and cannot figure out how to solve it. I try to host my silverlightapp in a consolehost. It can be refereced OK, but when the call is made, this exception occurs. Maybe I put the xml-files in the wrong place? My service is configured like:
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000"/>
</baseAddresses>
</host>
<endpoint address="BusinessService" contract="MyApp_Contracts.IBusinessService" binding="basicHttpBinding"/>

An I put both clientaccesspolicy.xml and crossdomain.xml in the consoleapp:s directory. I that the right place?

Regards
/Erik
11/25/2009 9:24 AM | # re: My Silverlight application cannot access my service!
Erik -- if you are doing a self-hosted service, that self-hosted service will need to respond to the clientaccesspolicy.xml file request (note: you don't need both files).
11/25/2009 9:36 AM | # re: My Silverlight application cannot access my service!
Hi. That was quick!! :)
How do I do that? Is there any examle out there I can look at?
(I am so close now to get a really great app to work now.....)

/Erik
11/25/2009 9:41 AM | # re: My Silverlight application cannot access my service!
Slightly outdated on the XML file format, but the principal still applies: blogs.msdn.com/.../...elf-hosted-web-services.aspx
11/26/2009 12:10 PM | # re: My Silverlight application cannot access my service!
Thanks alot. That solved this problem.
Now I got another (maybe worse, I don't know). The thing is that I am trying to develop an 3 tier architecture, which have following layers

1) Web Layer (Silverlight)
2) Web Services proxy
3) Web services
4) Business Layer
5) Business Service Proxy
6) Business Service
7) Data Access Layer.

So, I call the Business layey through a proxy, It works fine, and his is the only service the Silverlight is going to reach at all I was thinking. The Business layer then maka a call to the datalayer through a proxy (net.pipes here), and there it failes with "Could not find endpoint element with name 'IPC_IAdmin' and contract 'Myapp_Contracts.IDatabaseService This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element."
So, If I switch the Silverlight-app to a Winform-app, and use tha same call-chain, It works just fine. Do you have any idea, or maybe if you know some example with this scenario that works? I have surfed around the whole web now, it feels like, without any answer. Well there is some other with same task, but no one has given any answer.

Regards,
Erik
12/26/2009 11:53 AM | # re: My Silverlight application cannot access my service!
Hey there.

I have this problem for a long time now - I hope you can help me.

I just want to describe my situation to you. Basically i have Solution in VS, which contains a webservice (.asmx), a Silverlight Application and a website which embeds the silverlight part. I also have a Library, which contains the DataSet and I have database running (SQL Server 08). The Webservice has a link to the Library to get data out of the DB and returns it to the silverlight application.

Now I do have the problem, that my webservice, which I'm using in the Mainpage of Silverlight doesn't return data. It seems, that the programm completes the webservice, because it does the other things I programmed in the related event handler. For test i just tried to add an item to a combobox, which i have on my website. e.g. I just added this line of code and which worked pretty fine:

this.ComboBoxHousingComplexes.Items.Add("Hi");

The webservice itself must work, i tested it in a Console Application and it worked fine there...

At first I had the problem, that debugging isn't working. I finally found out, that "View in Browser" solves my problem and doesn't throw a communication Exception, which I get, when i wanted to debug the project (F5). Actually I can't debug at all, but it works relatively fine, I can view it - debugging (with Breakpoints) isn't really possible. But my main problem is, that the webservice doesn't return data and i dont know why.

Please could you help me, it's really important for me - it's part of my diploma project.

Thanks in advance.

Regards,

Oliver
12/27/2009 3:00 PM | # re: My Silverlight application cannot access my service!
Hey,

I just tried your Tutorial and I'm always stopped by an Exception. It's the System.ServiceModel.CommunicationException and it is thrown at Reference.cs:

public FooApp.ServiceReference1.HelloWorldResponse EndHelloWorld(System.IAsyncResult result) {
object[] _args = new object[0];
FooApp.ServiceReference1.HelloWorldResponse _result = ((FooApp.ServiceReference1.HelloWorldResponse)(base.EndInvoke("HelloWorld", _args, result))); // In this line!
return _result;
}

I'm always getting this exception when i try to debug it with F5. If I choose "View in Browser" there is no result in this case. Neither "Hello World" nor an Exception is shown in my Silverlight application.
I'm so desperate, I hope you can help me.

I would be really greatful, if you could help me. It's so important for me, because it's part of my diploma project.

Many thanks in advance.
Regards,
Oliver
12/28/2009 1:03 PM | # re: My Silverlight application cannot access my service!
Hey out there.

I just wanted to tell you, that I found a solution to my problem. You must have just your crossdomain.xml in the WebService Directory - delete the clientaccesspolicy.xml!

My Crossdomain.xml contains:
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "www.macromedia.com/.../...ain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="SOAPAction" />
</cross-domain-policy>

Hope it helped anybody earlier than me (;

Regards,
Oliver
12/29/2009 7:20 PM | # re: My Silverlight application cannot access my service!
Actually Oliver this is incorrect. Silverlight prefers the clientaccesspolicy.xml -- you likely didn't have the correct format of one. Crossdomain.xml is an Adobe format and while slightly supported, it is not a format we control and thus is only marginally supported. Having the well formatted clientaccesspolicy.xml file is preferred and checked for FIRST.
2/11/2010 3:21 PM | # re: My Silverlight application cannot access my service!
Hi Tim,

Someone from AZDNUG had brought my plight to your attention last night. For the most part my web service on IIS was not allowing a Silverlight 3 project to create the Service Reference because of invalid endpoints and bindings in the service. When I got that squared away I had just cross domain issues left. Like Oliver when I deleted the clientaccesspolicy.xml from the service host application root the Silverlight 3 application woke up beautifully hosted inside an OOB SharePoint Content Editor web part! YEAH!
Like you say, the clientaccesspolicy.xml is probably hosed. Do you see anything wrong with it?

<?xml version="1.0" encoding="utf-8"?>
<access-policy>
<cross-domain-access>
<allow-from http-request-headers="*">
<domain uri="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</cross-domain-access>
</access-policy>
2/11/2010 3:25 PM | # re: My Silverlight application cannot access my service!
Jerry - you are missing the policy node. msdn.microsoft.com/.../cc645032%28VS.95%29.aspx
2/16/2010 4:12 PM | # re: My Silverlight application cannot access my service!
Tim,

Thanks for the great article. Not the first time you have helped me out of a headache.

JF Payette,

Your solution helped in my situation. Everyone has different situations to face, in our case we dont need the clientaccesspolicy file is my take. Maybe because we are accessing the different machines from the same domain.
4/29/2010 11:48 AM | # re: My Silverlight application cannot access my service!
Confirmed!

clientaccesspolicy.xml must have the line http-request-headers="SOAPAction" in it. Also you can remove the crossdomain.xml it's not needed. Oh my god, I spent AGES on this!

clientaccesspolicy.xml must also reside in the same directory that .svc file is in.

Thanks,
BillChen
4/29/2010 1:07 PM | # re: My Silverlight application cannot access my service!
BillChen -- actually to clarify the cap.xml file must reside in the ROOT directory of whatever the service endpoint is. So if your service is at /foo/services/myservic.svc the cap.xml must be at /clientaccesspolicy.xml.
5/3/2010 5:32 PM | # re: My Silverlight application cannot access my service!
RE: Hi Dan, I had simply reconfigured the virtual directory's properties on IIS.
Hope this help.

GL

GL, Could you provide more detail on what properties in the virtual directories properties you changed? I am getting the clientaccesspolicy.xml with a HTTP 304 result from fiddler but still getting the cross domain error from Silverlight. What gives?!
5/10/2010 11:15 AM | # re: My Silverlight application cannot access my service!
Tim Heuer, you are a living legend. Finally got my problem fixed due to this article. I'm a very happy man now. Thanks
5/20/2010 2:27 AM | # re: My Silverlight application cannot access my service!
Hi,

I am facing the issue in updating the Database during a browser close in the Application_Exit method. Since I cannot call a webmethod in the Application_Exit event to updated the DB, I'm trying for a workaround where I call another simple Silverlight Application for the sole purpose of performing the DB update.

The issue is that when I make the Async call to the method UpdateDataBaseAsync in my StopTimers function, it doesn't actually call the Webmethod and the values aren't getting updated in the DB.

Snippet:

// First Silverlight Application's Exit method
private void Application_Exit(object sender, EventArgs e)
{
SecondApplication.SecondAppMainPage objSecondApp = new SecondApplication.MainPage("10", "stop", System.DateTime.Now);
}


// Second Silverlight Application

public partial class SecondAppMainPage : UserControl
{
ABCServiceSoapClient abcClient = new ABCServiceSoapClient();
public MainPage()
{
InitializeComponent();
}
public MainPage(string id, string status, DateTime stopTime)
{
InitializeComponent();
StopTimers(id, status, stopTime);
}

Please give me a way out of this :)

Cheers,
Syed.
public void StopTimers(string id, string status , DateTime stopTime)
{
abcClient.UpdateDataBaseAsync(id, status, stopTime);
/// A call is being made to this Async function but the database update isn't
/// happening.
}
}
7/24/2010 6:41 AM | # re: My Silverlight application cannot access my service!
Thanks!! You save me some time.
12/30/2010 3:58 AM | # re: My Silverlight application cannot access my service!
Most important step in any of the resolutions above(SOAPAction in CAP file did trick for me with plain ASMX service) is -

EACH TIME YOU ADD/UPDATE CAP FILE ON SERVER HOSTING ASMX SERVICE, YOU HAVE TO REMOVE REFERENCE IN CLIENT/SL APP AND ADD SERVICE REFERENCE AGAIN.

This is how i got it working.

2/23/2011 10:45 AM | # re: My Silverlight application cannot access my service!
Another possible explanation for this error:

Is your service returning "light" objects, or the original objects in the model along with ALL of their relationships? For example, sayyou have "Region" and "Customer" objects in your model (from EF or whatever), and you are getting a list of regions. That will also bring back all the Customers in that region as children (Region.Customers). But if you define a "RegionLight" with a RegionKey and a RegionName, you cut off all the children and keep the web traffic down. In our case, this helped with the timeout/maxItemsInObjectGraph/server not found bundle of problems.
6/4/2011 3:08 AM | # re: My Silverlight application cannot access my service!
Hi. Useful information, many thanks to the author. Freshersworld||IT jobs
9/13/2011 12:31 PM | # re: My Silverlight application cannot access my service!
Hi, Tim so I have a silverlight application, actually a .XAP, embeded into a web user control ASCX. I put the ascx in a web domain hosted in a Windows Server 2003 with IIS6.
My XAP, call a operation that is hosted in the same WS 2003 and IIS6. but nothing happen, and when I use a debugger, just nothing happen not even try to seek the clientaccespolicy or crossdomain.....Is like my xap do not use the asmx.
Could you please help me. thanks in advance!!
1/5/2012 5:52 AM | # re: My Silverlight application cannot access my service!
Thanks tim but i have a still problem to change the virtual path of the wcf service . I am using VS2010.

 
Please add 5 and 1 and type the answer here:

DISCLAIMER:

The opinions/content expressed on this blog are provided "ASIS" with no warranties and are my own personal opinions/content (unless otherwise noted) and do not represent my employer's view in any way.