|
That's a bit too general. Post some code and the problem you are having (after Googling and trying to figure it out yourself, of course).
|
|
|
|
|
I found that your collection should be an ObservableCollection , and your collection items object should be derived from INotifyPropertyChanged . Once that's done' it should just work (assuming your Binding Path and ItemsSource is correct).
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I know, I use Observable collections as sorces for my controls. I construct them from EF data classes. But it doesn't really matter how do I construct them -- they stay as a part of GUI and are commited on a clich on a button.
OK, I know it's bad, but here I upload my project.
You are welcome to solve the WPF challenge. I think it will be easy for a professional -- most probably I do a big bad error which is usual for noobies. Enjoy.
Hotfile download[^]
I'm sorry - it's not because I am too lazy. I just don't know how to formulate a question. I have no idea what's going on - it should work, you know.
Thanks
Greetings - Jacek
|
|
|
|
|
When I call a method in a WCF web service from a silverlight app, I get this:
An exception occurred during the operation, making the result invalid. Check InnerException for exception details.<br />
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()<br />
at FMDashboard2.FMDashSvc3Ref.GetMetricDataCompletedEventArgs.get_Result()<br />
at FMDashboard2.Objects.DataRetrieval.service_GetMetricDataCompleted(Object sender, GetMetricDataCompletedEventArgs e)
Calling webService.OpenAsync() succeeds, but I can't call a method (which happens to be the one and only method in the service).
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Does inner exception provides something useful?
|
|
|
|
|
Wrap the code inside your MetricData method with a try/catch block and log the resulting exception using the .ToString() method. The method is just wrapped with a proxy for the asynchronous code, so the exception will be occurring in the context of the body of the method. I normally use log4net for tracking exceptions in my web services.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
The web service works fine when I run it locally (in the IDE), but I'll give it a try.
BTW, how can I debug the service locally? I can't get the debugger to jump into the code.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
If you've got the pdb files located alongside it, you can normally get to it via
Attach to Process from the Tools menu.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
No exception is being written. :/
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
So, we've pretty much ascertained that the problem isn't in the service. Basically, you need to look at the whole exception that's being received at the client end. Check the inner exceptions (right the way up the stack) to see what's going on.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
The body is alreadt wrapped in a try/catch block, and it works fine locally. The only reason I could think of why it would fail remotely is that the appropriate version of .Net wouldn't be installed, but I checked that, and the server has 3.5...
The first call (which fails) is simply returning a string that uses no .Net objects/methods to construct it.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
But what do you get when you log the exception? It sounds like a permissions issue is at fault here, so let's try to get to the bottom of that.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Permissions where - writing the log file? FWIW, I also tried turning on the WCF tracing, but i don't get a log file.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I actually meant you'd need to write out a log file (using log4net).
The permissions I was talking about was the permissions on the actual service itself.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Well, I fingered out how to get the inner exception (and wrote a tip/trick about it ), and for your reading pleasure, here it is:
An exception occurred during the operation, making the result invalid. Check InnerException for exception details.<br />
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()<br />
at FMDashboard2.FMDashSvc3Ref.GetMetricDataCompletedEventArgs.get_Result()<br />
at FMDashboard2.Objects.DataRetrieval.service_GetMetricDataCompleted(Object sender, GetMetricDataCompletedEventArgs e)<br />
============<br />
Inner exception: An error occurred while trying to make a request to URI 'https://myUrl/FMDash3.svc/secure'. <br />
This could be due to attempting to access a service in a cross-domain way without a proper <br />
cross-domain policy in place, or a policy that is unsuitable for SOAP services. You may <br />
need to contact the owner of the service to publish a cross-domain policy file and to ensure <br />
it allows SOAP-related HTTP headers to be sent. This error may also be caused by using <br />
internal types in the web service proxy without using the InternalsVisibleToAttribute <br />
attribute. Please see the inner exception for more details.<br />
at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)<br />
at System.ServiceModel.Channels.ServiceChannel.SendAsyncResult.End(SendAsyncResult result)<br />
at System.ServiceModel.Channels.ServiceChannel.EndCall(String action, Object[] outs, IAsyncResult result)<br />
at System.ServiceModel.ClientBase`1.ChannelBase`1.EndInvoke(String methodName, Object[] args, IAsyncResult result)<br />
at FMDashboard2.FMDashSvc3Ref.FMDash3Client.FMDash3ClientChannel.EndGetMetricData(IAsyncResult result)<br />
at FMDashboard2.FMDashSvc3Ref.FMDash3Client.FMDashboard2.FMDashSvc3Ref.FMDash3.EndGetMetricData(IAsyncResult result)<br />
at FMDashboard2.FMDashSvc3Ref.FMDash3Client.OnEndGetMetricData(IAsyncResult result)<br />
at System.ServiceModel.ClientBase`1.OnAsyncCallCompleted(IAsyncResult result)<br />
============<br />
Inner exception: <br />
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)<br />
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)<br />
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)<br />
============<br />
Inner exception: Security error.<br />
at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)<br />
at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)<br />
at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)<br />
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Are your clientaccesspolicy.xml or crossdomain.xml files visible? Have a read of this[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Visible? I have a ClientAccessPolicy.xml file in my web services's folder:
="1.0"="utf-8"
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri ="*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
I also have a CrossDomain.xml , but I'm not really sure where to put it, so I have it in a few places.
="1.0"="utf-8"
<cross-domain-policy>
<allow-http-request-headers-from domain="*" headers="*"/>
<strong>
<allow-http-request-headers-from domain="*" headers="SOAPAction" />
</strong>
<allow-https-request-headers-from domain="*" headers="*"/>
<strong>
<allow-https-request-headers-from domain="*" headers="SOAPAction" />
</strong>
</cross-domain-policy>
Where *should* I put it?
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
You only need the ClientAccessPolicy.xml file. I notice from the exception that you are using https - in the allow-from section, you need to add
<domain uri="http://*" />
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
doesn't this accomplish the same thing:
<domain uri=”*” />
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
No.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Ok then, but wouldn't it be more correct to do this?
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri ="http://*" />
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
<policy>
<allow-from https-request-headers="*">
<domain uri ="https://*" />
</allow-from>
<grant-to>
<resource path="/secure" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
If this is the way your site is set up, then yes. Alternatively, you could put both the https://* and http://* in the first allow-from if you don't have to worry about the secure path.
The reason you have to add the https://* is because SL requires that you explicitly opt-in to secure services.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Well, I went ahead and made that change, and it still gives me the same exception. :/
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
I'd offer to test it for you but I'm running SL4 now.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
I saw a comment on the web that stated moving to SL4 fixes this problem. I don't have that option. I'm going to try putting the SL app on the same server as the service and seeing if that will fix it.
EDIT ========
Nope. In fact in some ways, it made it worse...
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Wednesday, June 9, 2010 2:59 PM
|
|
|
|