Solved

Silverlight, WCF Service, and Out of Browser Experience

Posted on 2010-11-30
6
704 Views
Last Modified: 2012-05-10
I have the following code that I run to determine the address for my WCF service in my Silverlight application.

Public Sub New()
        myBinding = New BasicHttpBinding
        myBinding.ReceiveTimeout = New TimeSpan(0, 59, 0)
        myBinding.SendTimeout = New TimeSpan(0, 59, 0)
        myBinding.OpenTimeout = New TimeSpan(0, 1, 0)
        myBinding.CloseTimeout = New TimeSpan(0, 1, 0)
        myBinding.MaxBufferSize = 2147483647
        myBinding.MaxReceivedMessageSize = 2147483647

        address = New EndpointAddress(New Uri(Application.Current.Host.Source, "../service/EKService.svc"))
        proxy = New EKServiceClient(myBinding, address)    
    End Sub

Open in new window


My application currently runs fine if I am running it in the browser, but if I try to run it out of the browser the application returns a NotFound error when trying to get information from the WCF service.  I am currently trying to run the application through Visual Studio 2010 and stepping through the code shows that I am still getting the valid url for the WCF service.  Additionally, I am able to successfully open the link in a browser window.  As a result, I am unsure why I am having this problem.

My ClientAccessPolicy.xml file is:

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

Open in new window

0
Comment
Question by:kmcbrearty
  • 3
  • 3
6 Comments
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 34241621
address = New EndpointAddress(New Uri(Application.Current.Host.Source, "../service/EKService.svc"))

".." holds no  reference out of browser.  

If running out of browser you may want to write a text configuration file that you can read from later on.  

The you can do something like:

if in_browser then
  address = New EndpointAddress(New Uri(Application.Current.Host.Source, "../service/EKService.svc"))
else
   address = readUriFromFile()
end if

0
 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 34241674
0
 
LVL 3

Author Comment

by:kmcbrearty
ID: 34241757
Did you happen to read the part where I explained that I stepped through the code and the address was resolved correctly?
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 3

Author Comment

by:kmcbrearty
ID: 34241788
Also, information from the link that you provided also indicated that it should be able to resolve relative URIs.


The origin parameter indicates the URI of the application's site of origin. This is required to assign security privileges, such as access to isolated storage. It also provides a base URI that the application can use to resolve relative URIs, access remote resources, and perform application updates.
0
 
LVL 40

Accepted Solution

by:
Kyle Abrahams earned 500 total points
ID: 34249214
ensure you client access policy is in the root of your website (eg: c:\inetpub\wwwroot) and not the application itself.

You're running it out of browser on the same machine?  Have you tried using fiddler to see what's going on?
0
 
LVL 3

Author Closing Comment

by:kmcbrearty
ID: 34364798
Due to time constraints I went another direction but I appreciate your help.  You provided valid information but I am uncertain if it would have completely solved the issue that I was having.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question