Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Silverlight, WCF Service, and Out of Browser Experience

Posted on 2010-11-30
6
Medium Priority
?
727 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 41

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 41

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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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 41

Accepted Solution

by:
Kyle Abrahams earned 2000 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

824 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