views:

24

answers:

1

I have a normal .asmx web service which loads fine in the browser. When I load the web page with the Silverlight app in it, the data doesn't load and I get a javascript error which states;

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E) Timestamp: Wed, 1 Sep 2010 16:43:32 UTC

Message: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at Operations.Dashboard.DashboardMetrics.GetP200MA_CountCompletedEventArgs.get_Result() at Operations.Dashboard.MainPage.client_GetP200MA_CountCompleted(Object sender, GetP200MA_CountCompletedEventArgs e)
at .Operations.Dashboard.DashboardMetrics.MetricsSoapClient.OnGetP200MA_CountCompleted(Object state) Line: 1 Char: 1 Code: 0 URI: http://ukhqdevmp-3790:8080/ChartTestPage.aspx

Message: Unhandled Error in Silverlight Application An exception occurred during the operation, making the result invalid. Check InnerException for exception details. at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary() at Operations.Dashboard.DashboardMetrics.GetP200C_CountCompletedEventArgs.get_Result() at Operations.Dashboard.MainPage.client_GetP200C_CountCompleted(Object sender, GetP200C_CountCompletedEventArgs e)
at Operations.Dashboard.DashboardMetrics.MetricsSoapClient.OnGetP200C_CountCompleted(Object state) Line: 1 Char: 1 Code: 0 URI: http://ukhqdevmp-3790:8080/ChartTestPage.aspx

It all runs fine within VS but when accessing it from another PC via IIS, it doesn't work.

MetricsSoapClient client = new MetricsSoapClient();
client.GetP200C_CountCompleted += new EventHandler<DashboardMetrics.GetP200C_CountCompletedEventArgs>(client_GetP200C_CountCompleted);
client.GetP200C_CountAsync(yearStart, yearEnd);
client.GetP200MA_CountCompleted += new EventHandler<DashboardMetrics.GetP200MA_CountCompletedEventArgs>(client_GetP200MA_CountCompleted);
client.GetP200MA_CountAsync(yearStart, yearEnd);

public void client_GetP200C_CountCompleted(object sender, DashboardMetrics.GetP200C_CountCompletedEventArgs e)
{ ... 

UPDATE: Using Fiddler, I can see that it's a security issue, I'm guessing a double-hop one.

Login failed for user 'DOMAIN\UKHQDEVMP-3790$'.

A: 

First off, you should verify that when you move it to another PC that your webservice address is correct and you are not trying to connect to localhost or something relative to your Visual Studio enviroment.

I remember having this issue but very vaguely and I can't remember what my solution was so I went back and looked at some code for a previous project and how the web service was setup. This is a long shot but maybe my code will help point you in the right direction if the web service setup is incorrect. Check the following line I had and see if it helps with anything (this was done with Silverlight 3):

Uri uri = new Uri(Application.Current.Host.Source,
    "../Services/YourWebService.asmx");

// notice this line is commented out and a * is used for biniding instead
//System.ServiceModel.BasicHttpBinding binding = new System.ServiceModel.BasicHttpBinding(); // "*"

YourWebService.YourWebServiceSoapClient = 
    new YourWebService.YourWebServiceSoapClient("*",
            new System.ServiceModel.EndpointAddress(uri));
Kelsey
When I add the service reference to the Silverligfht project, it adds all the methods in as per my code comment above. I then use these to add my rendering logic.
sparkymark75