The given path's format is not supported


On one of our web service applications, we are getting the error shown below.

The strange thing is that it only seems to happen when we are calling a couple of service methods and not in all service methods in the application.

The other strange thing is that we are not doing any file manipulation in either of these methods or in fact anywhere in that particular repository.

I have checked all of our logs, permissions on the application folder and all of the code and am struggling now to find out what is going on. We use ServiceStack extensively across our systems and this is the first time I have seen this issue.

Any advice would be very much appreciated.

Many thanks


mscorlib : System.NotSupportedException
The given path’s format is not supported.

at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
at System.IO.DirectoryInfo.Init(String path, Boolean checkHost)
at ServiceStack.VirtualPath.FileSystemVirtualDirectory.EnumerateDirectories(String dirName)
at ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetDirectoryFromBackingDirectoryOrDefault(String dName)
at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.GetFile(Stack1 virtualPath) at ServiceStack.VirtualPath.AbstractVirtualPathProviderBase.GetFile(String virtualPath) at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext()
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate)
at ServiceStack.Host.AspNet.AspNetRequest.GetFile()
at ServiceStack.Host.AspNet.AspNetRequest.get_IsFile()
at ServiceStack.HttpHandlerFactory.GetHandlerForPathInfo(IHttpRequest httpReq, String filePath)
at ServiceStack.HttpHandlerFactory.GetHandler(HttpContext ctx, String requestType, String url, String pathTranslated)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The Exception indicates it’s trying to access an illegal file path, i.e possibly containing illegal characters.

What’s the URL that this exception occurs on?


Thanks for the prompt reply. Much appreciated.

This is one of them.

This page returns a successful metadata response:

Are you saying this URL generates this Exception? If this Exception is thrown within the HttpHandlerFactory it should return an error response.

I do not get an error thrown back to the client when I call it, but the error appears to be getting thrown internally in the web service application before any of our code is actually reached.

The page doesn’t have any dependencies so there’s no other resource requests that would cause this and it’s impossible for an Exception thrown in HttpHandlerFactory.GetHandler() to be able to return a successful page, in order to return the metadata page it needs to return the metadata handler that renders the page, which can’t happen if an Exception is thrown.

If you can send a stand-alone repro I can investigate.

I dont think there will be much point in sending a stand alone repro. As I say, we use ServiceStack all over the place in about 30 different applications and never had a problem until we created this new one.
I just dont beleive I can build it to go wrong and this application itself has many dependent assemblies.

I guess I am just back to trying to work out what the hell is going on.

I’d look to find the exact URL that causes the error to see if it contains any illegal characters, I can’t see how the URL provided could throw an Exception at the ASP.NET Entry point but is still able to render a page, so I’m assuming a different request is causing it.

It is absolutely that URL and one other that always causes this issue. I can call it now with a small console app that I have created. No exception will be shown in the console app and nothing comes back in the response to indicate an error - but I will be able to check in Loupe a few minutes later and see the error in the web service as shown in my last attachment.