While trying to change a setting for your IIS application, you may come across this error message: There was an error while performing this operation. Details: Exception from HRESULT: 0xC00CEF03.
This issue mostly occurs after you migrate your application from one IIS server to another.
Root Cause
0xC00CEF03 error code translates to WR_E_NSPREFIXWITHEMPTYNSURI which refers to “Writer: cannot use prefix with empty namespace URI” (Reference).
This error occurs when there is something wrong with the web.config file. It’s probably corrupted or there are incompatible tags and parameters. As a result of this corruption and incompatibility, IIS is not able to read this file. Therefore, it can’t make a change.
The issue mostly happens after migration because a piece of configuration that works in the older version of IIS (and .NET Framework) probably became unsupported in the newer version.
Solution for the 0xC00CEF03 error (Cannot use prefix with empty namespace URI)
The shortest way of finding what part of the web.config is causing the issue is to remove sections one by one and test. High-level steps:
- Remove a section from the bottom of the file (Let’s say you removed
system.serviceModel
section) - If the issue goes away, add the section back and start removing the subsections of it one by one. (For example,
ws2007HttpBinding
subsection insystem.serviceModel
section) - If the issue goes away again, bring the subsection back and go through each lines. Prefixes like
wsid:
,asm:
, andtrust:
are the most common causes of this issue
Sample code
For the application I worked with, the problematic subsection in the web.config file was the one below.
<tokenRequestParameters>
<trust:SecondaryParameters xmlns:trust=http://docs.oasis-open.org/ws-sx/ws-trust/200512>
...
<trust:Claims Dialect=http://schemas.xmlsoap.org/ws/2005/05/identity xmlns:trust=http://docs.oasis-open.org/ws-sx/ws-trust/200512>
<wsid:ClaimType Uri=http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name Optional="true" xmlns:wsid=http://schemas.xmlsoap.org/ws/2005/05/identity/>
<wsid:ClaimType Uri=http://schemas.microsoft.com/ws/2008/06/identity/claims/role Optional="true" xmlns:wsid=http://schemas.xmlsoap.org/ws/2005/05/identity/>
<wsid:ClaimType Uri=http://schemas.wolterskluwerfs.com/ws/2012/09/identity/claims/effectiverootorg xmlns:wsid=http://schemas.xmlsoap.org/ws/2005/05/identity/>
</trust:Claims>
...
</trust:SecondaryParameters>
</tokenRequestParameters>
In order to solve the issue, I removed;
trust:
from<trust:SecondaryParameters>
wsid:
from<wsid:ClaimType>
After the changes, the code looked like this:
<tokenRequestParameters>
<SecondaryParameters xmlns:trust=http://docs.oasis-open.org/ws-sx/ws-trust/200512>
...
<trust:Claims Dialect=http://schemas.xmlsoap.org/ws/2005/05/identity xmlns:trust=http://docs.oasis-open.org/ws-sx/ws-trust/200512>
<ClaimType Uri=http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name Optional="true" xmlns:wsid=http://schemas.xmlsoap.org/ws/2005/05/identity/>
<ClaimType Uri=http://schemas.microsoft.com/ws/2008/06/identity/claims/role Optional="true" xmlns:wsid=http://schemas.xmlsoap.org/ws/2005/05/identity/>
<ClaimType Uri=http://schemas.wolterskluwerfs.com/ws/2012/09/identity/claims/effectiverootorg xmlns:wsid=http://schemas.xmlsoap.org/ws/2005/05/identity/>
</trust:Claims>
...
</SecondaryParameters>
</tokenRequestParameters>
After changing the web.config, please make sure to test your application.