Consuming SharePoint 2010 WCF from .Net 4.5 + Store portable class library (PCL) - wcf

Can VS2012 build a proxy in a PCL project to consume a WCF service for SP2010? We add a reference (old school works everywhere else) but once we make calls, for instance GetListsCollectionAsync(), we get all sorts of errors. When we build the proxy, VS gives a warning:
Service proxy generation failed. Proxy requires type 'System.Xml.Linq.XElement' which is not supported in portable libraries
Has anyone successfully subscribed to a SharePoint WCF using a portable class library? The same stuff works fine in .net 4.5 class libraries and in metro libraries. Only portable ones give us this problem. We have win 7 and win 8 devices in the mix - so PCL would be a really good fit.

Got a conclusion here: We found a work around and the statement that this is a bug in VS2012 PCL projects still stands.
We created our proxy in a metro project and simply copied the reference.cs file over into the PCL project. It was a "what the heck - why not" last attempt of sorts, but it actually works. Even better, the calls are awaitable and come with response objects. Awesome!
Cheers,
Gregor

Related

How to add WCF Service to .NET Core project in Visual Studio 2019?

I am unable to add a connected service reference to a WCF endpoint in VS 2019. I used to be able to do it in VS2017 with an extension. Now I can't find the extension anywhere, and when I try to add a connected service, I get lots of options but nothing for a WCF service.
Just to clarify, I am not trying to develop a WCF service, just trying to create a service reference to act as a client to a remote WCF service.
There is an article on how to use such a tool, here, but absolutely no information on where to find the tool or how to install it. I even found what may be the source code for the tool, but again with no installation instructions.
My project is a .NET Core project, targeting NetStandard 1.6.
.Net Core is still supporting client-side. You can use hosted service in it and add the ip:port/wcfinterface from the connected services.
You can try it by following this link.
I was able to resolve this issue by simply creating a new class library targeting NetStandard2.0. Right-clicking on Dependencies -> Managed Connected Services now showed an additional item below the Service Dependencies item, called Service References. Adding a new Service Reference, you are then presented with a WCF option.
I tried re-targeting this class lib back to NetStandard1.6, and all is still working. My original class lib was very old, and had some old stuff like dnxcore50 in the .csproj file, so maybe something there was screwing it up.
Thanks all for the suggestions.

Is it possible to upgrade a Windows 8.1 App to a UWP Windows 10 app and have WCF project within the UWP app?

I need to upgrade an existing windows 8.1 Mobile app to work on windows 10 and started looking into this.
I have managed to port the code to UWP and it builds and runs the UWP app - so far so good.
However within the app there is a WCF project which is used to go get data and this isn't working.
I am currently getting this error Could not load file or assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Is it even possible for a UWP app to contain a WCF project and this will work?
In the VS2015 solution this all works but in VS2019 it doesn't work as in the ServiceFactory class cant even create an instance.
I have next to no experience of UWP or Windows 8.1 Mobile apps and any advice would be great.
Thanks
Gregor
Note that the WCF Client is actually available for .NET Core/.NET Standard! It's only the server-side part that is not available for .NET Core.
WCF Service: .NET Framework
WCF Client: .NET Standard based (works with .NET Core and .NET Framework)
In your case, if I understand you correctly, you want to call an existing service, which means you need the WCF client, and you can actually use that WCF client with .NET Core/.NET Standard 2.0 and so also with UWP.
Do the following:
Add a new .NET Standard Class Library project to your solution (this will replace the WCF client library that you have already in your solution)
In Solution Explorer, right click on Dependencies and select "Add Connected Service"
This will bring up a page within Visual Studio where you see the "Microsoft WCF Web Service Reference Provider":
Click on it, and the dialog below opens up:
In the dialog above, type in the URL of your service, and the dialog will generate the whole WCF client code for you and it will also add references for the required WCF NuGet packages.
Reference the .NET Standard 2.0 class library project from your UWP project and use it.
Note: WCF-Client in .NET Core does not support the configuration file entries known from .NET Framework projects. That means that the configuration is generated in the C# code.
I hope this helps,
Thomas

Is there a way to prevent svcutil from implementing IExtensibleDataObject?

I'm trying to create a Portable Class Library. It will support .Net 4.51 & Windows Store apps.
For some reason the option to Generate Task-Based Operations is disabled. Yet both .Net 4.51 & WIndows Store apps support this.
There is a connect issue open as will not resolve and the work around doesn't work or isn't something we would want if it did.
Questions
1) Is there a svcutil for Windows Store Apps? (Add Service Reference from a Windows STore app and trying to shoehorn it into a PCL isn't what we're looking for.)
2) Is there a way to prevent svcutil from implementing IExtensibleDataObject?
Thanks

Is it possible to make aspnet ModelBinding work in .Net Framework 4.0 Web Forms?

We have a couple of relatively large Web Forms web application projects, but we are limited on using the .net 4.0 because some of our clients are still using Windows Server 2003, and the .net4.5 is not compatible with that OS.
Would it be somehow possible to make the model binding framework created on the .net4.5 work with the .net4.0 WebForms? Maybe something along the lines of extension methods on .net2.0 (although that is obviously almost 100% compile time stuff) or LinqBridge.
If that was possible to some extent, I think I would take the time to do it. Maybe if the code can be extracted from the original sources (I'm downloading them right now to see how it works) and be plugged like an extension or inheritance of sorts in our current page life cycle.
Does that mechanism have some external dependency that would make this prohibitive?
The WebForms-based feature required changes which are only available in 4.5.
That said, if you require model binding in some form, you could always try using the ASP.NET MVC or WebAPI frameworks for the particular part of your site in which you require model binding, leaving the rest as WebForms. They both currently only require .NET 4.0. And you get the benefit that both of those are supported products.

Monotouch Web Reference Namespace Issue

I have an ASP.net web service sitting on a server, and I have verified that it works properly via a small test client app in VS.
I went to add it in MonoDevelop to my MT application, (Trying both the ASP.net 2.0 and WCF declarations). Inside the "Add Web Reference" wizard, it finds the web service fine. But when I go to reference it, the app doesn't know it exists.
I went to look at it, and it seems when adding it, the namespace it's assigning to it is the title of my solution (which has spaces in it), but the namespace for each of my .cs files within my app contains no spaces.
Web Service Namespace (that it wont let me change): Ultimate GameDay 2011
MT Application Namespace: UltimateGameday2011.
So I manually went into the reference.cs file and took out the spaces. The app classes then saw my web reference object, but it still won't allow me to access any of its members.
Any help would be greatly appreciated.
Check out the following link http://merbla.blogspot.com/2011/03/monotouch-with-json-using-aspnet-mvc.html
Its not a fix to your problem rather a method of creating web services that MonoTouch more easily works with. In my experience ASMX and WCF services have been problematic when consuming in a Monotouch app.
If all else fails, try using the Silverlight service utility located in your programs folder
e.g. C:\Program Files (x86)\Microsoft SDKs\Silverlight\v4.0\Tools\SlSvcUtil.exe