WCF - It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.

You've created a simple WCF service, and deployed it to IIS.

You navigate to your service URL, but get the above error.

The full error message looks like this:

The solution:

The error text does provide the correct solution -- to convert the directory to an application -- but there is a situation in which creating an IIS application doesn't work.

First, try the suggested fix.

1 Open IIS Manager, right click on the directory to which you deployed your service, and select Convert to Application. Accept the defaults, and click Okay.

[convert-to-application.gif]
[add-application.gif]

Did that work? It didn't for me. So, next, check your service URL. I had this:

http://localhost/wcf/service1.svc

My problem was that I had created the IIS application on the zuga-dev domain (aliased to 127.0.0.1 in my hosts file) but I was accessing the page through localhost. They both point to the same directory, so the problem wasn't immediately obvious.

The solution was to 1) create the IIS Aplication on "Default Web Site" (i.e. localhost) or 2) access the service using the correct hostname, the hostname for which I had created the IIS application.

http://zuga-dev.net/wcf/service1.svc
You should see something like:

Ads by Google


Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath