ObservableCollections are no longer returned when I update my service reference - wcf

I have a Silverlight 5 app. This app has been in development for 18 months. This app calls back to a WCF service. I just had a support request.
Before today, the service would return ObservableCollection<T> results. However, now all of the sudden, out-of-the-middle of nowhere, it starts returning T[] results after I updated the service reference in the Silverlight app.
My question is, what could have happened that would cause this change? This has caused approximately 70 errors due to type conflicts. Am I overlooking a basic setting?
Thank you!

If you're using a service reference to communicate with the service, make sure the Data Type hasn't been changed. Right click on the service in the Service References folder, select Configure Service Reference..., and look at the Data Type - Collection type:. If it's System.Array, then this may be your problem. Change it to ObservableCollection and see if that helps.

Related

Update Service Reference file change

I am stuck in a very strange problem. I am consuming a wcf service in asp.net project using VS. Everything was fine before, but suddenly wcf service updation started behaving strangly. As soon as i update the service reference by right clicking on the service and selecting Update Service Reference, it deletes all the file and create new file with different name. I got the updated service with different file(wsdl,xsd etc) name because of these I am not able to check in the code.Even delete and add of service reference give the same.
Everytim when I took update service reference, it update the wsdl,xsd file with different name instead of update in the same file.
Looking forward any guidance to solve this problem.
Thanks in advance
It sounds as if the service endpoint is changing in some way between updates. If the service endpoint changes the service reference will also change accordingly. This is normal and expected.

Stackoverflow Calling My WCF Operation Only from WCFTestClient

I'm calling a WCF operation and was running into the classic circular reference issue where my primary object (Persons) included a reference to another object (Reminders) which I need to contain a reference back to Persons. I fixed this using ReferencePreservingDataContractFormatAttribute (documented well online if you Bing it). And the fix works great for calling my service from my website project. When I attempt to call it from WCFTestClient, however, I get a Stackoverflow Exception. If I take off my .Include("Person") in my service operation then it works just fine in both. Does anyone have any ideas why this might happen? I compared the serviceModel sections of the config files to be sure there were no significant differences. Thanks for any ideas you can provide.
Keeping in mind that it works from your website project but not from your test client there are 3 possibilities:
You have not updated the service reference in your test client (9 times out of 10 that is the problem)
There is some other bug in your test client
The call from your test client uses different parameters and is therefore returning different data.

Getting Null Back from Method Call

Ok, let me first state some facts:
This is a web service that has been working. There are several .svc endpoints all of which worked. Right now though there's one that is not, meaning I can make method calls to it when I consume the service through another project but I keep getting null back as a result.
The code for the methods in this service that continually sends back null HAS NOT CHANGED
I did mess around with the endpoint configuration pointing it to a couple different servers. I tried the original server it was pointed to also. No matter what I can update the service fine but even if I set it back to the old endpoint path, I still get null back from my unit tests when testing calls to this service. The unit tests are running in the project that's consuming the service of course
I've checked the app.config and web.config for the service itself. As far as I can see everything looks fine...but again I'm new to WCF
I know this is pretty general but I'm looking for some guidance on where to start looking to see why I'm getting null back all of a sudden. The stored proc behind these methods have not changed. Again these method calls were working at some point in time in the past week but now it isn't.
This is very general, but a few things to try...
Try updating your service reference to ensure you have the most recent version of your proxy objects
Have you tried debugging inside your service and seeing if the expected return value is being returned from the service prior to the client getting it?
Do you catch all exceptions in the service and then return a result object or do you let exceptions fall through? If you let them fall through, the WCF channel might be getting faulted.
Try using Fiddler and seeing if the endpoints you think should be getting called are and if the response object is indeed null.
Use an old-school trick and write the result to a file on the server just before you return to the client. This will help you know whether or not it is a server-to-client serialization issue. You may even need to write to file right as the service gets the call to make sure your client is connecting.
What you really need to do is start by debugging inside your service and stepping through the code there. Make absolutely certain the SPROC is returning what you expect and then there isn't an environmental bug introduced.
When you have weird problems with WCF, the fist thing to do it configure WCF tracing. It's a very powerful tool. You can even see the content of messages.
Here is the official doc on this: Configuring WCF Tracing

WP7 consume a WCF Service

I have a WCF web service deployed on azure. When I consume it using WCFClientTest, I successfully get return data after invoking my methods.
But when I try to consume it through WP7... it returns nulls (collections of objects are expected, either empty or filled with objects of course).
I've read over the internet that lot of people had such problems, but couldn't find a straight fix to this, I restarted Visual Studio to get rid of the well known warning related to the web service reference while developing for WP7 but it didn't help at all, and my code has no warnings left.
I guess it's a problem with serialization or maybe security... I really don't know
Did anybody run across such an issue already ?
Any directions to solve it ?
PS: I deploy on emulator
Edit:
In order to back up my question, I'd like to let you know that I've just tried using a method that returns a simple string and this works. So the problem is with collections.

WCF Getting "The primary signature must be encrypted." from FaultContract with ProtectionLevel.None

I have an existing asp.net application that talks to load balanced wcf services (iis hosted, in app pool running under account configured as servicePrincipalName, etc.). The wcf services return a few custom faults, all defined with FaultContract(typeof(x), ProtectionLevel = ProtectionLevel.None) -- these services are not exposed to the public. The client uses the 'service reference' generated classes to access the services.
This has worked fine but now, with the latest code base, we are getting "The primary signature must be encrypted." exceptions on the client when the service returns one of these faults. The service code and configuration is unchanged (at least the legacy parts that generate the faults). The client side service reference generated code appears the most changed (it often gets removed and recreated).
The security configuration is unchanged for over a year. All the updates are pretty current. We've tested this in three environments and as soon as we deploy the new code base, the faults start generating exceptions. Seems like it has to be in the generated classes but they are generated by Visual Studio so it is very perplexing.
Does this sound familiar to anyone? Any suggestions?
Update: Removing the ProtectionLevel attribute and allowing it to default makes the problem 'go away', but I am curious why specifying None causes it to fail. Perhaps it conflicts with the default level of the operation contract or service contract, but those values have not changed in the past year so that doesn't explain why what had worked now doesn't.
Update: For what it is worth, this change in code gen happened between 2.0.50727.3053 and 2.0.50727.3082 (according to the runtime-version comment in the generated code).
I haven't experienced this problem myself, but my questionn is: why on earth do you specify a "ProtectionLevel=None" in your fault contract? Any particular reason for that?
If not, I'd strongly recommend not specifying that at all - the default is ProtectionLevel=EncryptAndSign and that's usually your best bet all around. Try it, unless you have a very strong and explicit reason against it.
Marc