Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts

Monday, May 04, 2015

Migrating my Postman collections from one MS-Windows system to another

Right now I’m in the process of migrating developer stuff from my old MS-Windows pc to a new one. On the old machine I’ve used the Postman tool often to test and deploy new web-services. After having installed the tool on the new pc I wanted to copy my collections from the old pc. This article describes how to accomplish this.

  • Start Postman on the old system
  • My collections
    image
  • In the Menu Bar click on the Settings icon
    image
  • In the Settings dialog window, click on the Data tab
    image
  • Click on the Download button to download your collections in a dump file. The ‘Save As’ dialog window opens. Select a name and location on a file share that can be reached by the new PC.
    image
  • Save the file.
  • Close the Postman tool on the old PC.
  • Start the Postman tool on the new PC.
  • In the Menu Bar click on the Settings icon.
  • In the Settings dialog window, click on the Data tab.
  • This time click on the ‘Select file’ button in the ‘Import Data’ section.
  • In the ‘Open file’ dialog select the postman dump file you created in the file share.
  • Click Open and that’s it. My collections are now available on the new PC.

Thursday, August 28, 2014

Test LightSwitch OData services with Fiddler v 2.4.x

Make a visual Studio 2013 Lightswitch app based on the Northwind SQL database.

Application name: NorthwindLS

Data Source: NorthwindData

The Lightswitch app is published to an IIS server ‘myhost’

Normally the media format of the OData will be ‘atom’.

To show result in JSON format with Fiddler

Start Fiddler v 2.4.x

In the composer tab next to the GET command, enter the URL of the Odata service published by the Lightswitch app: http://myhost/NorthwindLS/NorthwindData.svc

In the textbox under the GET command, there are 2 lines of text that are sent to the server

User-Agent: Fiddler
Host: myhost

Add a 3rd line: Accept: application/json;odata=verbose

image

click the Execute button to execute the Get command. The response will be in JSON format.

Thursday, May 08, 2014

Odata service with EF 6 and WCF services 5.6 fails with Request Error

Problem

I tried to follow a few more examples about building OData services with Visual Studio 2013, Entity Framework 6 and WCF Services 5.6, but when I tried to browse the Wcf (OData) service from VS 2013, it starts IE wiith an error message:

“Request Error. The server encountered an error processing the request. See server logs for more details.”

image

I tried various combinations, but to no avail (I even used another development system to try in case my development environment was botched up).

Solution

Eventually I found an anwser in stackoverflow.com foru, by Kourosh.

“it seems the entity framework 6 and wcf data services 5.6 , need some provider to work together. you can download the provider simply by using nuget package console manager :

Install-Package Microsoft.OData.EntityFrameworkProvider -Pre

it’s version is alpha 2, so in future, search for final release. it worked for me however.

final thing is instead of DataService, you need to use EntityFrameworkDataService. T is the name of your entities.”

Thank you Kourosh. Now my OData service with EF 6 and WCF data services 5.6 works!

Procedure

Step 1: install the package

Step 2: edit the WCF webservice c sharp code and replace DataService with EntityFrameworkDataService.

using System.Data.Services.Providers;
 
namespace DataAccessMydata
{
    public class ODataMydata : EntityFrameworkDataService<MydataContext>

Wednesday, April 30, 2014

Creating an OData Endpoint in ASP.NET Web API 2 tutorial

Recently I wanted to migrate a Web service that returns an array of database records to the most recent WCF service and return a List<T>.

Lightswitch can be used to generate Odata services almost without any coding.

But recently I have come to this set of articles, that explain step by step how to create a full Odata service with CRUD functionality in VS 2013: Creating an OData Endpoint in ASP.NET Web API 2 By Mike Wasson (feb 2014).

Monday, March 03, 2014

WCF client: The request channel timed out while waiting for a reply after 00:00:59.998

Problem

A WCF service that needs to prepare a list of technical data which it requests from an external system, needs between 1 and 2 minutes to respond. The WCF client times out with the message

“The request channel timed out while waiting for a reply after 00:00:59.998…”

Solution

Increase the send timeout value on the client service instantiation.

MyWcfService.MyWcfServiceClient dsvc = new MyWcfServiceClient();
//TimeSpan(days, hours, minutes, seconds) - increase send timeout to wait for 10 minutes
dsvc.Endpoint.Binding.SendTimeout = new TimeSpan(0, 0, 10, 0);  

Disadvantage


Every client application needs to set the timeout value. In this particular case it would be sufficient to set the timeout value on the service server side, preferably with values in web.config. I need to investigate this further.