Solved

Silverlight, WCF Service, and Out of Browser Experience

Posted on 2010-11-30
6
703 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now