Solved

Silverlight, WCF Service, and Out of Browser Experience

Posted on 2010-11-30
6
700 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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
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 39

Expert Comment

by:Kyle Abrahams
Comment Utility
0
 
LVL 3

Author Comment

by:kmcbrearty
Comment Utility
Did you happen to read the part where I explained that I stepped through the code and the address was resolved correctly?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Author Comment

by:kmcbrearty
Comment Utility
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 39

Accepted Solution

by:
Kyle Abrahams earned 500 total points
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

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…
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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

6 Experts available now in Live!

Get 1:1 Help Now