Silverlight cross domain confusion - silverlight

I have a Silverlight application that does two things:
1) connects to a WCF server (hosted inside a WPF app on a different PC) and sends small packets of info (using PollingDuplexHttpBinding if it matters)
2) sends a web request for get an XML file from a different remote server for parsing
At dev time, its all running locally, but in production it will be a scattered deployment each running on a different server.
But I am running into issues that I think are related to the clientaccesspolicy.xml and crossdomain.xml files
My Silverlight app runs at a random port (as defined by VS2010)
The WCF service runs at: http://localhost:80/MyService which I can connect to just fine from the SL client (I have got a clientaccesspolicy.xml file on the WCF side)
But, and here is the part that is failing, when I send a request for the XML file, which is http://localhost/MY_TEST_SITE/thefile.xml I get the error:
The remote server returned an error: NotFound.
but I put that address into Firefox I can see the XML file no problem. I do have a clientaccesspolicy.xml in that location, which I think is correct.
If it was a cross-domain issue should I be getting a security exception here? instead of a not found exception?
How can I debug this?

Its ok I figured it out, I had something blocking on port 80, which was causing a whole heap of issues, once I switched that off, it was back to normal

Related

Siverlight 4 Deployment : WCF RIA Services - “Not Found” Error Message

I have some issues deploying a Silverlight 4 application on a remote server machine. My application consist a Cosmopolitan theme (a master/child page model) that connected with 2 services to retrieve specific information.
The first service is pretty simple. It is an asmx service that sends back the User Logon name to the Silverlight application.
The second one is a LinqToSQL service that relay some information to some autocompletebox and search tool.
I have developed the application on my machine using a local SQL server. When I am testing locally with an address type like this one (http://localhost:4080), it is working perfectly. But when deploying on the server using the domain name, it is giving the error saying that the remote server returned an error: NotFound.
I followed and review every steps on of deployment but I still have a problem. I try by all means to find a solution to this problem. Of course go through the list of prerequisites provided on these sites:
http://msdn.microsoft.com/en-us/library/ff426912%28v=vs.91%29.aspx
First, I tried myself to deploy the application without having to disturb my network administrators that by installing the required dll’s in the Bin directory of my project. I have installed those 3 dll’s (System.ServiceModel.DomainServices.Server.dll, System.ServiceModel.DomainServices.Hosting.dll and Microsoft.ServiceModel.DomainServices.LinqToSql.dll). Of course, nothing worked.
I then ask the network administrator to install the WCF RIA services. Does he have to configure something other than installing the WCF RIA services? Is this service including the Microsoft.ServiceModel.DomainServices.LinqToSql.dll.
I suspect that my problem comes from a configurations file: ServiceReferences.ClientConfig or Web.config. But I have included the exact same information from the MSDN site of deployment so I do not see where my problem might be. Am I using the wrong technique to publish the project? I am publishing the site using the File System method and then after modifying the config file to point to the right domain name.
I am able to reach the services by typing the http://domainname/ MeritService1.svc. It is telling me that I can test with the svcutil.exe or slsvcutil.exe. Will I lose a lot of time testing this?
By the way, Fiddler does not give much information accept a 500 error code.
It seems that many developers have the same problem themselves but I do not know where to aim! Anybody have a clue?
Here are the specs:
Local machine: Windows XP,
Browser: IE8 with Silverlight
Server Machine: Windows 2003 with IIS 6, .NET 4.0 and WFC RIA installed.
The following link may be of some help
WCF RIA Services - “Not Found” Error Message

Problem uploading service for Silverlight SQL connection

I've found a very small sample showing Silverlight SQL connection (http://www.codeproject.com/KB/silverlight/CntDbSlght.aspx), I've tested it and it works fine on local system, also I've changed its connection string so that it shows data from my remote database, but when I upload files to my host, I cannot see any SQL data, it seems that something is broken, how should I configure my web.config?
What are CrossDomain.XML and ClientAccessPolicy.XML files? should I upload them? If so, where should they be? How should I bind my service? what am I doing wrong? I click on VS2010 publish (in build menu) and select file system, then I upload all files existing in this folder, I use C#.
If you are trying to access an external Silverlight web service from your local dev environment you certainly need a ClientAccessPolicy.XML file on the website. This tells the site services where requests can come from (normally only from the same site the SL app was run from).
Your ClientAccessPolicy.XML file needs to go into the actual root of your website i.e. 'mydomain.com/ClientAccessPolicy.XML.
*Note: You do not also need a CrossDomain.XML if you have ClientAccessPolicy (which is the SL specific one). CrossDomain.xml is an older flash compatibility file that sometimes exists on sites.

File Upload Cross Domain

The scenario I am trying to create is to have my Silverlight Website on one domain and my file server (for media files) on a different server. I want to allow my users to upload files to the file server from the website.
The problem is I am getting a generic "Security error." reported back in the inner exception message in my code. The main exception message is blank.
I have set all access right to the physical folders (Windows Server 2008). I have created wide-open clientaccesspolicy.xml and crossdomain.xml files.
I am using an .ashx handler for doing the actual writing to the hard drive. I have tested it locally on the file server machine and it works fine.
I have root level access to both servers so I can make any changes required.
I'm not a Silverlight programmer, but I might be able to help here... Browser security prevents pretty much any cross-domain actions like this. It's to prevent phishing.
What you could do to get around this is to create another hostname on the same domain as your webserver and proxy any requests on your webserver to your file server. That would get around the cross-domain problem.

Silverlight client never calls WCF Service

This one has me completed stumped. I have developed a silverlight application that calls back to WCF services ( it's a silverlight - basicHttpBinding)
The site works perfectly fine from my development machine, but when it is deployed to the developement server. The application is delivered with the XAP just fine, but it never attempts to talk to the service. I have a service call in the bootstrapper so it should be calling this when the client starts up. The services are healthy. They can be browsed to and show the standard WCF service display. We have been through the bindings many times and everything seems to be ok. I have added an extensive amount of error handling for displaying any errors, but on this dev server, no service calls and no errors are being raised.
Fiddler shows the page being loaded up, but my client never issues a call to the service. The service is in the same folder as the default.aspx which hosts the Silverlight client.
This is a Silverlight 3.0 app.
Anybody ever seen anything similar?
I will try to debug in three steps
Verify whether the hosted service on dev server is up or not, by hitting the service URL from your browser on your dev machine.
Make sure that ServiceReferences.ClientConfig consists ur hosted service URL and not dev machine service URL.
If still error occurs try to debug your application from visual studio by pointing the endpoint address to http://urserver/urservicename.svc
Also make sure you dont have have cross domain problems by using "silverlight spy" tool
Put a graphical display like "I made the call!" before the service invocation. just to be sure that your app is really trying to call the service...
So we could narrow the search to a communication problem. : )
Verify that there aren't any cross-domain rules stopping the app to make the call.
by the way, are you calling a WCF service from another domain?
Are you sure the silverlight app is loading at all? If you are making the service call in the boot strapper and the call breaks, I assume that will lead to just a blank page. If you are seeing just a blank page, then perhaps there is something wrong with the .xap mime type issued from the server. Here is some more info on that:
http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/

Silverlight clientaccesspolicy.xml crossdomain.xml

I am one of 2 developers on a silverlight project that is hosted online. The problem is that i seem to randomly have problems with our webservices not working (This never happens to my colleague).
Using firebug, i had a look at any problems that it was reporting and i found this:
GET clientaccesspolicy.xml 404 not found
GET crossdomain.xml 404 not found
Any ideas why only i have a problem with like this?
We have both cleared out our cache and recycled the application pool of the webserver... no joy.
Thanks,
Kohan
So the webserver intermittently returns 404 errors on the policy file? What version IIS?
If your colleague never gets the error, compare the request headers between his system and yours to be sure there isn't something weird going on.
If the policy file is hosted by a provider and you're getting intermittent 404 errors you should put in a ticket with the provider.
This happens when the client attempts to connect to a domain on which it is not hosted. The policy files are used to grant access to that server from the SL client.
Are you both running the client from the same location? Double check your proxy settings and hosts file too.
Found out the problem came when accessing the site without typing "www."
I should have known to check that first. :(

Resources