Wednesday, April 16, 2014

MongoDB: System error 1067 has occurred.

After installing MongoDB as a windows service I wasn’t able to get it started. Instead the following error message was shown:

The Mongo DB service is starting.

The Mongo DB service could not be started.

A system error has occurred.

System error 1067 has occurred.

The process terminated unexpectedly.

When MongoDB crashes like this, you have to do some clean up work before trying to start it again:

  • Delete the following file inside the /data/db/ directory: mongod.lock
  • mongod.exe –repair
  • Start the mongod service again

Tuesday, April 15, 2014

TypeScript error: Initializer of instance member variable cannot reference identifier declared in the constructor.

In a TypeScript application we are building, we have code similar to the following:

However when we try to run this, TypeScript complains with the following error message:

Error      19           Initializer of instance member variable 'processAllOrders' cannot reference identifier 'that' declared in the constructor.             

I think it’s a bug in TypeScript as I don’t see any reason why this shouldn’t work.

Monday, April 14, 2014

Error in Visual Studio 2013 when creating a new project: “No exports were found that match the constraint"

After installing some updates, my Visual Studio went bananas. When I try to create a new project, it always fails with the following error message:

No exports were found that match the constraint:
ContractName
Microsoft.VisualStudio.Text.ITextDocumentFactoryService
RequiredTypeIdentity
Microsoft.VisualStudio.Text.ITextDocumentFactoryService

No idea what’s causing the issue, but I was able to fix the issue based on the workaround mentioned on the Connect site:

  • Delete the ComponentModelCache folder at %AppData%\Local\Microsoft\VisualStudio\12.0.

Friday, April 11, 2014

Dojo: Esri.request is undefined

On a Single Page Application we are building, we use the ArcGIS API for JavaScript.  This API allows us to bring the power of the ArcGIS GIS functionality into our client application. The ArcGIS API for JavaScript is build on top of the popular Dojo toolkit. This means that we had to integrate Dojo inside our application.

So we added a Dojo config file to our application:

However when we ran the application and tried to load a Dojo module, it failed with the following error message:

Esri.request is undefined

It took us some time to figure out that the issue was related to one specific setting inside our DojoConfig; the async setting. If async is set to true, injected modules will be loaded when require is called. If async is not set, these modules are loaded immediately when dojo.js is loaded.

So to fix it, we updated the Dojo config to:

Thursday, April 10, 2014

The remote certificate is invalid according to the validation procedure

When calling an OData service from inside my ASP.NET MVC application, the call always fails with the following exception:

The remote certificate is invalid according to the validation procedure

The OData service I’m connecting to is available through HTTPS so I would guess that something is wrong with the SSL certificate.

Let’s walk through the checklist:

  • Hostname matches the name used in the certificate: OK
  • Certificate is not expired: OK
  • Encryption level is high enough: OK
  • The full certificate chain is trusted: OK

Mmm, strange. Everything seemed fine. And when I browsed to the OData service directly from the browser, I could get all the data as I would expect.

In the end I figured out that I had to give the MVC application access to the private key of the certificate.

Following steps fixed the problem:

  1. Export the certificate from the OData Service host(don’t forget to export the private key as well).
  2. Open MMC and load the Certificates snap-in.
  3. Import the certificate into the "Local Computer" account on the server where the ASP.NET MVC application is hosted.  Make sure to check "Allow private key to be exported"
  4. Give your IIS 7.5 Application Pool's identity Full Trust access to the certificate.

Wednesday, April 9, 2014

Nice Visual Studio Add-in: File nesting

File Nesting is a feature in Visual Studio that was available for a long time. It allows you to put multiple files together under one ‘root’ file. This is a feature you’ve certainly seen in WinForms(designer generated code and codebehind), ASP.NET WebForms(HTML page and codebehind) and so on… Unfortunately to use this feature yourself, you had to start editing the .csproj files yourself. Not the best way to start using a feature!

Thanks to Mads Kristensen File Nesting plugin this is no longer necessary and you can easily nest any file under another file in Solution Explorer.

What makes it even nicer, is that File Nesting also gives you the option to automatically nest based on file naming rules. You can then apply those rules to any files, folders or entire projects.

Install the plugin through the Visual Studio Extensions or download it here: http://visualstudiogallery.msdn.microsoft.com/3ebde8fb-26d8-4374-a0eb-1e4e2665070c.

Thanks Mads!

Tuesday, April 8, 2014

Free e-book: Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications

When you move your applications to the cloud, there are lot’s of new things you need to learn. But the cloud doesn’t only bring new challenges but also some great new opportunities.

To help you get the most of each cloud platform, Microsoft released a free e-book, Cloud Design Patterns: Prescriptive Architecture Guidance for Cloud Applications, that introduces some Cloud Specific Design Patterns. It contains twenty-four design patterns and ten related guidance topics that articulate the benefits of applying patterns by showing how each piece can fit into the big picture of cloud application architectures. It includes code samples and general advice on using each pattern.

image