【问题标题】:Value cannot be null. Parameter name: virtualPath - Sitecore值不能为空。参数名称:virtualPath - Sitecore
【发布时间】:2015-02-05 07:05:11
【问题描述】:

我在 sitecore 站点配置部分创建了一个新站点:

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

一旦我在配置中添加了新站点,当我转到 http://website.local/oscar-dresses 时。我得到值不能为空。参数名称:虚拟路径。我错过了什么吗?它在 sitecore 的预览模式下工作正常。

任何建议将不胜感激。

【问题讨论】:

  • 您好,您的内容发布了吗?
  • 是的,我又检查了一遍。它已发布。
  • 你能发布整个堆栈跟踪吗?
  • 为什么在第一个站点中有 (virtualFolder="/oscar-dresses")?这实际上是您网站文件夹中的文件夹吗?两个站点也有相同的主机名,每个站点应该有不同的主机名。

标签: xml sitecore sitecore7.1


【解决方案1】:

我实际上认为这是一个错误,除非这里有人可以纠正这个问题。我在为测试目的设置演示站点时遇到了同样的问题,并通过添加物理文件夹来解决它。

如果仅配置了虚拟文件夹,则 FileResolver 处理器不会在 args.Url.FilePath 中接收文件路径,并将空字符串传递给 DirectoryExists 方法。因此“值不能为空”。奇怪的是,如果您不传递虚拟文件夹,则 FilePath 设置为“/”并且处理器不会中断。当您只添加一个 virtualFolder 并将physicalFolder 保留为默认值时,我希望出现相同的行为。

简而言之:您可以为物理文件夹添加一个值,这应该可以修复它。

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

如果文件路径为空,您还可以覆盖 FileResolver 处理器并添加“/”。

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

但我们绝对应该向 Sitecore 支持报告问题。

【讨论】:

  • Sitecore 支持已响应并将其作为错误报告提交。建议的解决方法是向物理文件夹添加与虚拟文件夹相同的值。
【解决方案2】:

virtualFolder 和physicalFolder 需要匹配。这是一篇关于您正在尝试做的事情的博客文章:

http://firebreaksice.com/sitecore-managed-sites-as-virtual-folders/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-16
    相关资源
    最近更新 更多