IIS7: The path is not of a legal form.
I recently encountered the error “The path is not of a legal form.” from the IIS 7.0 Manager, but was unable to find any documentation on the error. Oddly this error didn’t log anything in the System Event Log either.
The error sounds like a config issue so I focused on web.config and applicationHost.config.
Problem:
When expanding a website in the IIS Manager we get the error below. This happens only for one specific web site, other sites are on the server are fine. Additionally the problematic site continues to serve out pages without error. The only real problem here is an inability to administer the web site.
Error:
Internet Information Services (IIS) Manager
The path is not of a legal form.
Screenshot:
Cause:
After inspecting applicationHost.config I noted that one application didn’t have a physical path specified.
<application path="/appdir" applicationPool="DefaultAppPool">
<virtualDirectory path="/" physicalPath="" />
</application>
Notes:
This is a situation that we should never find ourselves in, unfortunately we did. The IIS manager wouldn’t let us make this kind of configuration setting, the physicalPath is required. In our case we got here by a third party application installation failure.
After noting the config error in the applicationHost.config we also determined that the problem was detectable in the IIS Manager itself by viewing the applications in the application pool.
Once we were viewing the various applications in the application pool it was obvious that there was one application which had it’s Physical path set to blank.
Solution:
All Applications must have a valid physical path.