Hi,
It seems the download page was down for couple of hours today. Now that the page is up, I downloaded 2.0.9 version and setup my application to run. Btw, my application is a Silverlight 2 Beta 2 application using WCF, LINQ and SQL Server 2005 Express as the backend. I'm very well aware that WCF has a bug so only loopbacks (127.0.0.1) are supported. If thats the case, my first WCF call from silverlight is to check whether Internet connection is available. The following is my WCF method:
bool IUtilities.IsInternetConnectionAvailable()
{
try
{
WebClient wc = new WebClient();
string returnValue = wc.DownloadString("http://www.microsoft.com");
return true;
}
catch (Exception)
{
return false;
}
}
Here is my call to this WCF method from silverlight in Application_Startup() method in App.xaml
ExpenseTrackerWcfProxy.ExpenseTrackerClient proxy = new ExpenseTracker.ExpenseTrackerWcfProxy.ExpenseTrackerClient();
proxy.IsInternetConnectionAvailableCompleted += new EventHandler<ExpenseTracker.ExpenseTrackerWcfProxy.IsInternetConnectionAvailableCompletedEventArgs>(proxy_IsInternetConnectionAvailableCompleted);
proxy.IsInternetConnectionAvailableAsync();
proxy.CloseAsync();
void proxy_IsInternetConnectionAvailableCompleted(object sender, ExpenseTracker.ExpenseTrackerWcfProxy.IsInternetConnectionAvailableCompletedEventArgs e)
{
this.RootVisual = new Page();
}
I ran my startup page (default.html) from Firefox with the port assigned by Ultidev's Cassini 2.0.9 and it threw a exception as shown below:
Error: Unhandled Error in Silverlight 2 Application Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.Windows.Threading.DispatcherOperation.Invoke() Inner Exception: at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at ExpenseTracker.ExpenseTrackerWcfProxy.IsInternetConnectionAvailableCompletedEventArgs.get_Result()
at ExpenseTracker.App.proxy_IsInternetConnectionAvailableCompleted(Object sender, IsInternetConnectionAvailableCompletedEventArgs e)
at ExpenseTracker.ExpenseTrackerWcfProxy.ExpenseTrackerClient.OnIsInternetConnectionAvailableCompleted(Object state)
Source File: http://localhost:15372/Default.html
Line: 0
Does this indicate that the call above to
www.microsoft.com thru WebClient method is not supported by Cassini 2.0.9 due to the bug in WCF? My other question is if I convert all my WCF methods to asmx (including call to
www.microsoft.com to get data as shown above), will it work? Also, if the problem stated above is because of WCF bug, how come, the built in Cassini web server that ships with VS 2008 works like a charm?
I have also tried xampp (Apache Lite web server) and it has major drawback (no support for WCF at all). I think, even if it would have supported WCF, because of the WCF bug, it still may not work.
Thanks.