Solved

Silverlight, WCF Service, and Out of Browser Experience

Posted on 2010-11-30
6
707 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!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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