mardi 4 août 2015

WCF project not starting in Visual Studio, throwing "Object reference not set to an instance of an object"

When I try to run my WCF project starting from the .svc file either in Debug or Release, it just shows an alert "Object reference not set to an instance of an object". This is no error in my code, this is definitely a Visual Studio error.

The build succeeds, no errors or warnings.

I ran devenv.exe with the /log option, but the log shows nothing interesting. There are no new log entries created after the error appears.

Originally I was working in Visual Studio 2013 on Windows 8.1, but running the project in Visual Studio 2015 showed the same error. Even after reinstalling my system completely from scratch the error is still there (formatted, now running Windows 10).

I can resolve the issue when I create a new WCF project in the same solution, then copy all files into the new project and replace the namespace of the old project with the new one. Web.config settings are also identical (except for project namespace).

This error happened 3 times now and I always resolved it by copying code into a new project, which is not really an elegant solution especially as the project grows. I'm hoping to find a solution before it happens again.

Aucun commentaire:

Enregistrer un commentaire