ASP.Net WCF: The service cannot be activated because it does not support ASP.NET compatibility

Estuve dando vueltas con este error desde ayer y fue algo que, ciertamente, me hizo perder mucho tiempo.

El error surge por una falta de conocimiento en la forma en que trabaja WCF y ASP.NET cuando corren dentro del mismo sitio.

WCF y ASP.NET puede correr side-by-side pero se debe habilitar el modo de compatibilidad. Si no se hace, va a aparecer el mensaje de error del título:

The service cannot be activated because it does not support ASP.NET compatibility

Ahí se nos invitará a modificar la propiedad aspNetCompatibilityEnabled a false. Pero esto no resuelve las cosas totalmente porque habrá cosas en nuestro servicio WCF que no funcionarán como esperamos.

El problema que estaba teniendo yo al hacer esto es que HttpContext.Current me estaba devolviendo siempre null en mi servidor de pruebas (IIS Express). En el servidor de producción (AWS) funcionaba bien.

El problema aquí es que el servicio no se estaba activando bien. Para esto hay que seguir los siguientes pasos:

1. En primer lugar, la propiedad aspNetCompatibilityEnabled tiene que estar en true en el web.config:

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />

2. En segundo lugar, hay que importar el siguiente namespace:

using System.ServiceModel.Activation;

3. Y, por último, hay que decorar la clase de nuestro servicio de la siguiente manera:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
public class Service : IService

De esta forma podremos acceder a HttpContext.Current sin problemas.

Para más información sobre este tema, recomiendo este post de Microsoft: WCF Services and ASP.NET.

Meet the customer

Working remotely has its benefits but sometimes is good for certain projects, to have a closer contact with the customers. In fact, meeting our customers is one of the key aspects of our methodology and we believe it is important to meet us in person at least once, specially for long term projects and relationships.

In many occasions we have travelled to work at the customers’ offices and in other opportunities the customer has travelled down here to meet with us.

In 2005 we received the first visit of a customer from the UK. We were working in his startup idea and he decided to rent a place here in Buenos Aires. It was a very productive move because we had the opportunity to work together for three months with the customer and other of his collaborators on the same table.

Preparing a demo for the customer in our office in Buenos Aires.

Preparing a demo for the customer in our office in Buenos Aires.

We have a long record of travels to Mexico as well. We usually provide services to customers in the automotive industries for their plants in Mexico. So we travelled many times to cities like Aguascalientes and Cuernavaca, places where automotive plants are very important. We travelled approximately 15 times to México for meetings, installations and support to our customers in Mexico. So there you have another skill in our set: we support spicy food like the best!

Trabajando en Cuernavaca.

Working in Cuernavaca.

A punto de entrar a trabajar en Aguascalientes.

All set to work in Aguascalientes.

Working from the datacenter in Mexico.

Working from the datacenter in Mexico.

Other destination we have travelled to many times is Texas. Mainly for meetings, planning and support, we have travelled to Dallas to work from the customer offices. The first time we went there was for a GOT (General Operation Testing) of a project we were building for another customer. We spent two weeks working with the users of the system, testing, reviewing the work done and gaining important feedback.

Travel to Dallas

Travel to Dallas

The latest trips we have done have been to Costa Mesa, California. We are working in a new project for a customer who makes printers so we decided to boost up the project with three weeks of intense work from his office. I travelled there with Jose, one of my partners, and it was very positive because not only could we meet the customer but we could also see the printers we were working with closely, perform real life tests and also visit one of the beta users of the system we were building.

Working from the customer's office

Testing the project at customer’s office.

Our work place in Costa Mesa, California.

Returning home after 3 weeks of work in USA.

Estaremos en Barcelona para los 15 años de Centraldev

Curiosamente, no estaremos en Buenos Aires para los 15 años de Centraldev sino que estaremos de viaje en Barcelona. Tenemos clientes en Madrid, pero no tenemos clientes en Barcelona por lo que si alguien de Barcelona desea comenzar a ser nuestro cliente, ¡aún está a tiempo para que lo invitemos una cena y unas cervecitas el día 3 de Agosto! 😀

What’s the difference between cheap and fair price outsourcing?

A fair price outsourcer will probably have a decent office to work from. A cheap one will probably work from his bedroom.

A fair price outsourcer will probably be able to pay someone to clean his office. A cheap one will have spend time to do the housework.

A fair price outsourcer will probably have decent equipment, update it frequently and maintain it. A cheap one will probably have constant problems with his/her equipment.

A fair price outsourcer will probably be able to pay a good internet connection. A cheap one will probably suffer disconnections every day.

A fair price outsource will probably be able to focus in your project without distractions. A cheap one will probably have to find additional side projects to make ends meet.