consuming WCF service in .net 2.0 windows application - wcf

I'm new in WCF service and I need to consume the WCF service from my client for my current .net 2.0 windows app. I successfully added the WCF service as web reference in my .net 2.0 application but when using the web method of the service it took long time to execute the method and in the end my application is not responding. Base on the request in fiddler, the request has been timed out. My client provides me a user name and password but I don't know where to use it. Base on the wcf web service wsdl of my client, it uses WSHttpBinding.
I also created a sample .net 4.0 windows application and added the service as reference but still cannot use the web method. I check also the request in fiddler and gives me a response error "The request for security token could not be satisfied because authentication failed.".
Please help. I need to consume the WCF service using my existing .net 2.0 application.
Thank you very much in advance!

If you want to consume your WCF service from .NET 2.0 via adding web reference you must use BasicHttpBinding - that is only backward compatible build-in binding (except custom defined binding) with ASMX based client.
Your exception in case of .NET 4.0 test complains about security token - WsHttpBinding uses Windows security by default. It is hard to diagnose the problem further because you didn't provide enough information.

Related

WCF Rest Service Reference in ASP.net core 3.1 API

I've created a WCF Restful service(Framework 4.7.2) and hosted the service in IIS sever. I would like to add the service on a ASP.net core 3.1 Api. It does fails while adding it via connected service. The wcf service has endpoint with webhttpbinding.error
Any help would be appreciated..
Core does not support webhttpbinding, wcf only supports BasicHttpBinding, CustomBinding, NetHttpBinding, NetTcpBinding:
So there are two current solutions:
Modify the binding of the server, do not use webhttpbinding.
The client continues to use the .net framework.
Feel free to let me know if the problem persists.

Is is possible for a Compact Framework 2.0 App to consume a WCF Web service

We are in the process of creating a new WCF web service (WCF service that has an basicHttpBinding Endpoint) to carry out some of our business logic.
The web application connects not problem at all, however our legacy Compact framework application doesn't seem to see the service at all.
Are we on to a loser here and should we just revert to ASMX web service (the Compact framework cannot be upgraded) or is there a way around this?
Yes you can but you need to treat it as a soap service not a WCF service with all the .net 3.5 goodness. Start up your web service and create web service reference in your .net 2.0 CF and use the auto generated code.

Exposing meta data for a WCF 4.0 Rest Template Service

Probably missing something very basic. I created a WCF 4.0 Rest Service. It works no problems when I'm hitting the url from a browser and I'm getting back what I want.
But now I want to use that service from a client mvc application (it will also be used by other non .net platforms which is why it's a rest service in the first place).
Problem is how do I get a service reference to it so I can start to use it in my c# code? With the new minimal WCF .net 4 config approach and no interface for the service contract, I don't know how to specify a mex endpoint. Ultimately I don't want a mex endpoint in production, just during development. I would love to be able to specify that all my services (around 10 in one application) have endpoints with one tiny piece of config that vs2010 .config transformations just rips out when I publish.
Stop. REST service doesn't use metadata. Metadata (Mex endpoint) are only for SOAP services because WSDL 1.1 (the only version supported by WCF) is able to describe only SOAP service. WADL or WSDL 2.0 is able to describe REST service but non of them is currently supported by WCF.
REST service is consumed by using WebRequest directly or by building ChannelFactory on top of shared contracts. Both methods are described here. Other method is to use HttpClient from REST Starter kit (former API). The problem with Starter kit is that it has never reached RTM (it was replaced by WCF 4). Instead of metadata endpoint WCF 4 REST service offers help page where all operation are described. When using WCF 4 REST template the help page should be already turned on - just add /help sufix to address of your service. Here is another article about building REST clients.

consuming wcf in .net 2.0 winform

How can we consume WCF service in .Net 2.0 Winform. Please note that we don't have IIS on the client. an example or a sample would be great.
It all depends on how your WCF endpoints are configured.
If you're using SOAP based WCF Services over HTTP, you should be able to simply add a Service Reference from your .NET 2.0 WinForms application and be on your way (which is what I would suggest doing).
If that's not the case, you'll have to provide a little more detail about what you're trying to do with your WCF Services.
You can host your WCF service in a Windows Service as per this article. In that case, it will listen on the HTTP protocol on any port you configure.

WCF (Param encryption and .NET 1.1 clients)

I'm starting in the WCF world and would like to ask your opinion on something.
I need to implement a service exposing one method that receives a couple of parameters. I want the parameters, submitted from a form in the client to the service, to be sent encrypted in the SOAP message.
The service needs to be accessed from .NET 3.5 clients and also 1.1. It is not possible to install the WCF service via a windows service, it needs to be deployed as a IIS app.
My questions:
- How can the WCF service assure encryption of the input parameters? A certificate in the client or are there any alternatives?
- Is there any problem consuming the WCF service via 1.1 apps, or even other non .NET clients?
- Do you think this scenario is implementable with WCF?
Thank you in advance
There is no way for a .NET 1.1 application to call a WCF service unless that service is exposed through basicHttpBinding. That binding only permits the use of SSL for encryption.
SSL on the web service host.
.NET 1.1 doesn't support automatic encryption, or WS-Security. You can encrypt/decrypt the parameters manually, though.