Cannot use prefix with empty namespace URI

  • Thread starter Thread starter Nedim
  • Start date Start date
N

Nedim

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

medium?v=v2&px=400.jpg





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=OASIS WS-Trust Specification>
...
<trust:Claims Dialect=Default xmlns:trust=OASIS WS-Trust Specification>
<wsid:ClaimType Uri=http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name Optional="true" xmlns:wsid=Default>
<wsid:ClaimType Uri=http://schemas.microsoft.com/ws/2008/06/identity/claims/role Optional="true" xmlns:wsid=Default>
<wsid:ClaimType Uri=http://schemas.wolterskluwerfs.com/ws/2012/09/identity/claims/effectiverootorg xmlns:wsid=Default>
</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=OASIS WS-Trust Specification>
...
<trust:Claims Dialect=Default xmlns:trust=OASIS WS-Trust Specification>
<ClaimType Uri=http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name Optional="true" xmlns:wsid=Default>
<ClaimType Uri=http://schemas.microsoft.com/ws/2008/06/identity/claims/role Optional="true" xmlns:wsid=Default>
<ClaimType Uri=http://schemas.wolterskluwerfs.com/ws/2012/09/identity/claims/effectiverootorg xmlns:wsid=Default>
</trust:Claims>
...
</SecondaryParameters>
</tokenRequestParameters>




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

Continue reading...
 
Back
Top