标签: sitecore7

用于MVC渲染的URL的变化缓存?

使用Sitecore 7,我的大多数查询字符串都成为自定义路由.例如:

OLD: /calendar?year=2013&month=7&day=14
NEW: /calendar/2013/7/14
Run Code Online (Sandbox Code Playgroud)

结果,我发现自己需要通过URL而不是查询字符串来改变我的渲染的HTML缓存.Sitecore是否提供了一种通过URL为MVC渲染变化缓存的便捷方式?

UPDATE

我发现所有MVC渲染都通过mvc.renderRendering管道,其中的缓存键在以下类中生成:

Sitecore.Mvc.Pipelines.Response.RenderRendering.GenerateCacheKey

通过重写GenerateKey(Rendering rendering, RenderRenderingArgs args)此类的方法,我可以使用成功附加原始URL site.Request.FilePath.我现在面临的问题是如何从渲染本身中提取此缓存设置?我想我需要在渲染上创建一个新的"VaryByUrl"缓存选项,但我不太确定.

更新2

我能够使用以下代码从渲染定义项中读取自定义字段.它工作,但它只查看定义项(不是演示文稿详细信息中的渲染的实际实例)

protected override string GenerateKey(Rendering rendering, RenderRenderingArgs args)
{
    var key = base.GenerateKey(rendering, args);

    if (rendering.RenderingItem.InnerItem.Fields["VaryByUrl"] != null)
    {
        var varyByUrl = ((CheckboxField)rendering.RenderingItem.InnerItem.Fields["VaryByUrl"]).Checked;
        if (varyByUrl) key += GetUrlPart(rendering);
    }

    return key;
}
Run Code Online (Sandbox Code Playgroud)

sitecore sitecore7 sitecore-mvc

6
推荐指数
1
解决办法
1310
查看次数

Sitecore 7中的奇怪超时

我已经使用Sitecore版本7.1几个月了,并注意到Sitecore客户端在闲置约20分钟后让我退出.其他用户在内容编辑时也报告了这些问题.

我正在使用Windows 7,IIS 7,.NET framework 4.5.

我已经检查了错误日志中的任何内容,并且看不到明显的错误并且keepalive服务正在运行 - 我在日志中获取此信息:

ManagedPoolThread #14 12:47:24 INFO Scheduling.UrlAgent started. Url:http://testsite/sitecore/service/keepalive.aspx
Run Code Online (Sandbox Code Playgroud)

我在日志中得到了一些,但这可能是相关的吗?

WARN  Memory usage exceeded the MemoryMonitor threshold
Run Code Online (Sandbox Code Playgroud)

当我离开它20分钟后回到现场.我在日志中得到这些条目.

952 15:08:28 INFO  AUDIT (sitecore\grahams): Logout
952 15:08:28 WARN  Protected page accessed with no current user
6440 15:08:28 INFO  AUDIT (sitecore\grahams): Logout
6440 15:08:28 WARN  Protected page accessed with no current user
Run Code Online (Sandbox Code Playgroud)

有没有看到过这种情况的身体,或者有任何迹象表明我如何能够达到这个目的?

提前致谢

伊恩

sitecore session-timeout sitecore7 sitecore7.1

6
推荐指数
1
解决办法
5303
查看次数

Sitecore Social Connector 2.1不与Sitecore 7.2一起使用

嗨,当我尝试在sitecore 7.2中安装Social Connected 2.1时,我收到此错误

找不到配置节点:contentSearch/configuration/defaultIndexConfiguration/analyzer

无法找到解决方案.

任何人都可以帮我解决这个问题.

提前致谢!

sitecore sitecore7 sitecore-social-connected sitecore7.2

6
推荐指数
2
解决办法
955
查看次数

适用于Marketters的Web表单(WFFM)带有占位符属性的Html输入标记

我有一个要求,我正在实施sitecore WFFM来创建一个表单.该页面包含带有Placeholder属性的HTML输入标记.我必须将WFFM SingleLineInput框渲染为具有占位符属性的输入标记.我该怎么办?

我知道这个SingleLineText类是在Sitecore.Form.Web.UI.Controlsdll中定义的.

sitecore web-forms-for-marketers sitecore7

6
推荐指数
2
解决办法
2878
查看次数

如何将标准值应用于使用Glass.Mapper创建的项目

我通过Glass.Mapper创建一个Sitecore项目,如下所示:

var homeItem = sitecoreContext.GetHomeItem<HomeItem>();

// Create the car item
ICar car = sitecoreService.Create(homeItem.BooksFolder, new Car { Tires = 4, Seats=4});
Run Code Online (Sandbox Code Playgroud)

这是有效的,除了Car模板上的标准值没有应用 - 或者如果它们被新的Car属性立即覆盖.因此,如果Car对象的Color属性值为null,则将此null写入字段,而不是Car模板上标准值的"绿色"值.

我已经通过Glass.Mapper寻找一种明智的方法来做到这一点,但什么都没发现.有没有办法通过Glass.Mapper来做到这一点?

c# sitecore sitecore7 glass-mapper

6
推荐指数
1
解决办法
768
查看次数

常规链接类型字段 - 如何添加另一个插入选项

我正在使用常规链接字段在Sitecore中插入URL.

我想创建一个自定义插入选项(不想覆盖GeneralLink字段),但我找不到任何与之相关的文档.新的插入选项是输入tel模式链接(例如:tel:99999999)

有没有人这样做过或有任何想法?

sitecore sitecore7

5
推荐指数
1
解决办法
1408
查看次数

我可以在SitecoreQuery属性中使用相对快速查询吗?

我正在安装Sitecore 7 + Glass Mapper 3,我希望对其进行优化.

我的代码的一个例子是:

[SitecoreQuery(".//*[@@templateid = '{011EC776-D9F3-4D73-8D8D-E454417E7574}']", 
                                                               IsRelative = true)]
IEnumerable<ItineraryLine> Itinerary { get; set; }
Run Code Online (Sandbox Code Playgroud)

我希望使用FastQuery,但我得到错误:

期望在第4位的字符串结束

尝试以下解决方案,这涉及到getLookupSourceItems管道的插入- 但我不认为这是正确的管道,因为它不会在调试中触发.

Glass是否在此场景中使用了另一个管道(如果有的话)?有没有不同的方法可以解决我加快速度的目标?

如果我没有使用属性而是使用扩展方法,我可以手动执行此操作并使用*[@@id='']设置根节点,但我希望尽可能避免这种情况.

c# sitecore sitecore7 glass-mapper

5
推荐指数
1
解决办法
1771
查看次数

内容搜索,重建索引错误

我是Sitecore的新手,并且有一项任务是使用SiteCore 7 API构建搜索.在搜索结果查询执行时收到以下错误.

System.ArgumentNullException: Value cannot be null. Parameter name:
fieldNameTranslator
Run Code Online (Sandbox Code Playgroud)

从以下行引发的错误

IQueryable<SearchResultItem> results = context.GetQueryable<SearchResultItem>();
Run Code Online (Sandbox Code Playgroud)

堆栈说

Sitecore.ContentSearch.Linq.Solr.SolrIndexParameters..ctor(IIndexValueFormatter valueFormatter, IFieldQueryTranslatorMap`1 fieldQueryTranslators, FieldNameTranslator fieldNameTranslator, IExecutionContext[] executionContexts) +284
Run Code Online (Sandbox Code Playgroud)

我已登录到内容管理系统,在索引管理器中我正在尝试重建sitecore_web_index的索引,但是我收到以下错误

Job started: Index_Update_IndexName=sitecore_web_index|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Sitecore.Exceptions.ProviderConfigurationException: Solr operations unavailable. Please check your global.asax,
Run Code Online (Sandbox Code Playgroud)

c# lucene solr sitecore sitecore7

5
推荐指数
1
解决办法
3378
查看次数

Sitecore 7.5 MVC和HttpContext.Session.Timeout设置为1分钟

我将会话超时设置为20分钟但是当我尝试从操作中访问此值时,我得到了1分钟.

Web.Config设置是:

<sessionState mode="InProc" cookieless="false" timeout="20">

<authentication mode="None">
  <forms name=".ASPXAUTH" cookieless="UseCookies" timeout="20" />
</authentication>
Run Code Online (Sandbox Code Playgroud)

在Global.asax.cs中,Session_Start的超时值为20min:

HttpContext.Current.Session.Timeout
Run Code Online (Sandbox Code Playgroud)

但在我的控制器中的操作设置为1分钟:

System.Web.HttpContext.Current.Session.Timeout 
HttpContext.Session.Timeout
Run Code Online (Sandbox Code Playgroud)

我发现当我从web.config中删除SitecoreHttpModuletype(Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus)时,超时工作正常,但我不认为我可以永久删除它.

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="WebDAVModule"/>
      <add type="Sitecore.Web.RewriteModule, Sitecore.Kernel" name="SitecoreRewriteModule"/>
      <!-- !!!REMOVED MODULE!!! <add type="Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus" name="SitecoreHttpModule"/> -->
      <add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel" name="SitecoreUploadWatcher"/>
      <add type="Sitecore.IO.XslWatcher, Sitecore.Kernel" name="SitecoreXslWatcher"/>
      <add type="Sitecore.IO.LayoutWatcher, Sitecore.Kernel" name="SitecoreLayoutWatcher"/>
      <add type="Sitecore.Configuration.ConfigWatcher, Sitecore.Kernel" name="SitecoreConfigWatcher"/>
      ...
    </modules>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)

有没有我可以为此模块配置此超时的地方,还是有其他方法可以将会话超时设置为所需的值?

asp.net-mvc session sitecore sitecore7 sitecore7.5

5
推荐指数
1
解决办法
2374
查看次数

使用Sitecore()格式化Sitecore日期.字段()?

我需要使用自定义格式的日期(即dddd dd MMMM yyyy).是否可以将此格式传递给Sitecore().Field()?我想做这样的事情:

@Html.Sitecore().Field("Day1", new { @format="dddd dd MMMM yyyy"})

然而,经过一些谷歌搜索,我发现我要么创建一个自定义字段助手来做这个或自定义模型.使用基本Sitecore真的没办法做到这一点吗?这很重要,Sitecore().Field()因为我需要内容编辑器才能编辑值.

我们在Sitecore 7.5上

c# sitecore sitecore7 sitecore7.5

5
推荐指数
1
解决办法
5141
查看次数