Reputation: 1879
I have created a new site in sitecore site config section:
<site name="site2" hostName="website.local" virtualFolder="/oscar-dresses" physicalFolder="/" rootPath="/sitecore/content" targetHostName="website.local" startItem="/Oscar Dresses" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
<site name="website" virtualFolder="/" physicalFolder="/" rootPath="/sitecore/content" hostName="website.local" targetHostName="website.local" startItem="/home" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
Once I added the new site in config and when i go to http://website.local/oscar-dresses. I get Value cannot be null. Parameter name: virtualPath. Am i missing something? Its working fine in preview mode from sitecore.
Any suggestion will be appreciated.
Upvotes: 2
Views: 5498
Reputation: 31435
The virtualFolder and physicalFolder need to match. Here's a blog post about what you're trying to do:
http://firebreaksice.com/sitecore-managed-sites-as-virtual-folders/
Upvotes: 5
Reputation: 1155
I actually think this is a bug unless someone here can correct this. I ran into the same issue while setting up a demo site for testing purposes and worked my way around it by adding a physical folder as well.
The FileResolver processor receives no filepath in the args.Url.FilePath if only virtual folder is configured and passes an empty string to the DirectoryExists method. Hence the "value cannot be null". Strange thing is that if you do not pass a virtual folder then the FilePath is set to "/" and the processor does not break. I'd expect the same behavior when you only add a virtualFolder and leave physicalFolder to default.
So in short: You could add a value to physicalFolder, that should fix it.
<site name="site2" hostName="website.local" virtualFolder="/oscar-dresses" physicalFolder="/oscar-dresses" rootPath="/sitecore/content" targetHostName="website.local" startItem="/Oscar Dresses" database="web" domain="extranet" allowDebug="true" cacheHtml="true" htmlCacheSize="10MB" registryCacheSize="0" viewStateCacheSize="0" xslCacheSize="5MB" filteredItemsCacheSize="2MB" enablePreview="true" enableWebEdit="true" enableDebugger="true" disableClientData="false" />
You could also override the FileResolver processor and add "/" if the filepath is empty.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<pipelines>
<httpRequestBegin>
<processor type="SitecoreMvc75.Pipelines.FileResolver, SitecoreMvc75" patch:instead="processor[@type='Sitecore.Pipelines.HttpRequest.FileResolver, Sitecore.Kernel']"/>
</httpRequestBegin>
</pipelines>
</sitecore>
</configuration>
But we should definitely report an issue to Sitecore support.
Upvotes: 5