HTTP Error 500.19 – Internal Server Error – 0x80070021 (IIS 8.5)

I started getting below error in a fresh box where I have got windows 8.1 and Visual Studio 2013,

HTTP Error 500.19 – Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

Module    IIS Web Core
Notification    BeginRequest
Handler    Not yet determined
Error Code    0x80070021
Config Error    This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault=”Deny”), or set explicitly by a location tag with overrideMode=”Deny” or the legacy allowOverride=”false”.

HTTP Error 500.19 - Internal Server Error 0x80070021

To resolve the above I just enabled the Application Development Features under Word Wide Service as shown below

HTTP Error 500.19 - Internal Server Error -  This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false". 0x8007002 IIS Change

I hope this might help you.

WCF – REST enabled service

The WCF WEB HTTP Programming Model allows developers to expose Windows Communication Foundation (WCF) Web services through basic HTTP requests without requiring SOAP. The WCF WEB HTTP Programming Model is built on top of the existing WCF extensibility model. Using this article I’m going to explain how to create a REST enabled WCF Service. I have used a simple Patient Sevice to demonstrate the RESFful WCF Service.

What is REST

REST stands for REpresentational State Transfer. The term representational state transfer was introduced and defined in 2000 by Roy Fielding as a concept in his PhD dissertation . The REST is resource based, a resource can be a person, address, user etc and in a RESTful service we will be doing some operations on the resources. The constraints of REST are based on the same underlying principles that govern the Web. Those principles are,

  • User agents interact with resources, and resources are anything that can be named and represented. Each resource can be addressed via a unique Uniform Resource Identifier (URI).
  • Interaction with resources (located through their unique URIs) is accomplished using a uniform interface of the HTTP standard verbs (GET, POST, PUT, and DELETE). Also important in the interaction is the declaration of the resource’s media type, which is designated using the HTTP Content-Type header. (XHTML, XML, JPG, PNG, and JSON are some well-known media types.)
  • Resources are self-descriptive. All the information necessary to process a request on a resource is contained inside the request itself (which allows services to be stateless).
  • Resources contain links to other resources (hyper-media).

WCF and REST

WCF is the Microsoft framework for building applications that communicates over a network, regardless of the style or protocol. The WCF Services has the ability to expose REST services using System.ServiceModel.Web assembly. This ServiceModel gives you two attributes, WebGetAttribute and WebInvokeAttribute and a URI template mechanism that enables you to declare the URI and verb to which each method is going to respond.

Read more from CodeProject.com

WCF RESTful Service

WCF – Message Exchange Patterns (MEPs)

Message Exchange Pattern describes how the client and server should exchange messages, and also the MEP will make clear that the client is going to wait for any response from the service or just simply sending is enough ,or the client is expecting any callbacks from the service.

WCF supports three Message Exchange Patterns (MEPs). They are as follows.

Request-Reply

One-Way

WCF One-Way Message Exchange Pattern

Duplex

The below given diagram show how Duplex (One-Way) works.

Below given diagram shows how a Duplex (Request-Reply) MEP works,

Read more from CodeProject.com

 

WCF-Global Exception Handling using IErrorHandler

Global Exception Handling – IServiceBehavior and IErrorHandler
To demonstrate this we need to create an ErrorHandler class by implementing the IErrorHandler and also a ServiceBehaviorAttribute class by impementing a IServiceBehavior. IServiceBehavior allows you to implement a service behaviour attribute which takes a custom error handler parameter which implements IErrorHandler

The IErrorHandler type exposes two methods. HandleError and ProvideFault.

  • Use the HandleError method to implement error-related behaviors such as error logging, system notifications, shutting down the application, and so on, and return a value that specifies whether the exception has been handled appropriate.
  • ProvideFault enables the creation of a custom FaultException<TDetail> that is returned to to the client from an exception in the course of a service method.

The IServiceBehavior type exposes three methods. AddBindingParameters, ApplyDispatchBehavior and Validate. For this article we are much interested only in ApplyDispatchBehavior method.

  • Here AddBindingParameters provides the ability to pass custom data to binding elements to support the contract implementation.
  • ApplyDispatchBehavior provides the ability to change run-time property values or insert custom extension objects such as error handlers, message or parameter interceptors, security extensions, and other custom extension objects.
  • Use the Validate method to confirm whether the current service can execute properly according to your scenario.

How it works

Whenever an unhandled exception occurs in a service decorated with the service behaviour attribute, two methods on the global error handler are called automatically: ProvideFault which allows you to construct a FaultException (rather than let ServiceModel do it), and HandleError which is intended for logging. The ProvideFault method is called first on the worker thread that is invoking the service call and HandlerError is called asynchronously on a separate thread, so lengthy logging operations don’t block the service request thread from sending a FaultException back to the client immediately.

WCF Global Exception Handling

Read more from CodeProject.com

WCF – Exception Handling, FaultException,FaultException and FaultContracts

Whenever we write a program we should expect the unexpected and add appropriate code to handle those exceptions.When we write a windows based application we use try/catch blocks in our methods to catch exceptions, and also we show a user friendly message in UI.

But when we work with WCF Service, It is not that much straight forward, So

  • How do we handle exceptions in WCF Service?
  • How to propagate a user-friendly error message to the client, who consumes the WCF Service?
  • How to send business rule validation messages to WCF client?

Handling exceptions in WCF Service is different than usual exceptions in .NET. As the WCF clients may not be based on .NET Technologies we cannot utilize the .NET Exception object to exchange exception details over the wire. For this purpose we should have a generic way to pass exception details to all type of clients, who consumes WCF Service.

For this reason we have SOAP faults, SOAP faults are the way to propagate the exceptions from the service to the client application. .Net has FaultException<T> generic class which can raise SoapFault exception. Service should throw FaultException<T> instead of usual CLR Exception object. T can be any type which can be serialized.

Read more form CodeProject.com

WCF FaultException Caught

Visual Studio “14” CTP now available

Some hours back , the Visual Studio “14” CTP was released. An early preview of the next version of Visual Studio. You can find the Visual Studio and .NET release announcements on Soma’s blog. You can find a complete list of new features in the Visual Studio “14” CTP knowledge base article.

This Visual Studio “14” CTP brings together several new technologies that we recently announced including:

  • The .NET Compiler Platform, also known as “Roslyn,” which includes the upcoming version of our managed compilers for C# and VB as well as an API that enables developers to integrate with the VS compiler and language service more easily than they can today. You can read more about the .NET Compiler Platform on the C# and VBteam blogs.
  • Updates to the Visual C++ Standard Library, added utility functions, manipulators, functions, and several bug fixes that will improve productivity. To learn more about all the changes visit the C++ team blog.
  • Tooling for ASP.NET vNext. ASP.NET vNext is a lean and composable .NET stack for building modern web applications for both cloud and on premises servers. For more information about ASP.NET vNext go to ASP.NET vNext website and check out the ASP.NET team blog.

CTPs provide early adopters with an opportunity to try out the new and improved product features, and the ability to share feedback with the product team.

Please report bugs using Connect and share your suggestions through Send-a-Smile from within the IDE or on our UserVoice site.

Note, Visual Studio side by side support is not available on this early build. Do not install this CTP on a machine with any other version of Visual Studio installed.

Download .NET Framework 4.5.2 (Web Installer, Offline Installer)

The Microsoft .NET Framework 4.5.2 is a highly compatible, in-place update to the Microsoft .NET Framework 4, Microsoft .NET Framework 4.5 and Microsoft .NET Framework 4.5.1. The web installer is a small package that automatically determines and downloads only the components applicable for a particular platform.

This is a web installer. There are separate installers for web and offline installation. If you intend to redistribute either of these installers in the setup for your own product or application, we recommend that you choose the web installer because it is smaller and typically downloads faster. The web installer is a small package (around 1 MB) that automatically determines and downloads only the components applicable for a particular platform. The web installer also installs the language pack matching the language of the user’s operating system.

This is offline installer. If you dont want to use web installer then this will be the right option for you. This will enable you to install even if you are not connected to the Internet.

This version of the .NET Framework runs side-by-side with the .NET Framework 3.5 SP1 and earlier versions, but performs an in-place update for the .NET Framework 4, .NET Framework 4.5 and .NET Framework 4.5.1.

Please see the Knowledge Base Article KB2901954 for more information.

For important information about this release, see the .NET Framework 4.5.2 Readme File.