Cannot use prefix with empty namespace URI
Published Jul 29 2021 02:24 PM 3,937 Views
Microsoft

This error message may show up if you try to change an IIS setting: There was an error while performing this operation. Details: Exception from HRESULT: 0xC00CEF03.

 

It occurs mostly after you migrate your application from one IIS server to another.

Nedim_0-1627593351929.jpeg

 

 

Root Cause

0xC00CEF03 error code refers to WR_E_NSPREFIXWITHEMPTYNSURI which means “Writer: cannot use prefix with empty namespace URI” (Reference).

This error occurs when there is an issue with the web.config file. There are probably incompatible tags.

 

The issue mostly occurs after migration because a piece of configuration that works in the older version of IIS (and .NET Framework) may become unsupported in the newer version.

 

Solution

One way of finding what part of the web.config is causing the issue is to remove sections one by one and test. Here are the steps:

  1. Remove a section from the file (You can start from the bottom)
  2. If the issue goes away, add the section back and start removing the subsections of it one by one. (For example, ws2007HttpBinding subsection in system.serviceModel section)
  3. If the issue disappears again, bring the subsection back and go through each lines. Prefixes like wsid: and trust: are the most common causes of this issue

 

For the application I worked with, the issue caused by the section 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>

 

To solve this issue, I removed;

  • trust: from <trust:SecondaryParameters>
  • wsid: from <wsid:ClaimType>

 

The code looked like this after the changes:

 

<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>

 

Note: Please make sure to test your application after making changes to your web.config file

Co-Authors
Version history
Last update:
‎Jul 29 2021 02:24 PM
Updated by: