小编Dom*_*nin的帖子

调试ASP.NET MVC绑定的最佳实践

你能给我一些关于如何调试ASP.NET MVC Binding的一般建议吗?

当一切按预期工作时,ASP.NET MVC非常棒.但是,如果某些事情没有,就像某些事情因某些未知原因而无法结合,我发现很难追查问题并发现自己花费数小时追踪一个看似简单的问题.

让我们假设您使用如下控制器方法:

[HttpPost]
public ActionResult ShipmentDetails(Order order)
{
    //do stuff
}
Run Code Online (Sandbox Code Playgroud)

让我们进一步想象Order类看起来像这样:

public class Order
{
    public decimal Total {get; set;}
    public Customer Customer {get; set;}
}

public class Customer
{
    public string Name {get; set;}
    public string Phone {get; set;}
}
Run Code Online (Sandbox Code Playgroud)

Order在控制器方法中没有正确绑定时,有什么好的起点?只有部分Order正确绑定时,有什么好的开始?

asp.net-mvc

48
推荐指数
3
解决办法
2万
查看次数

如何命名.bowerrc文件?

这个MEAN-stack教程描述了使用Bower在公共文件夹中安装AngularJS.其中一个步骤描述了在test-app文件夹中创建名为".bowerrc"的文件.但是,Windows不允许您创建没有名称的文件.如何在Windows系统上完成此操作?

bower mean-stack

32
推荐指数
4
解决办法
2万
查看次数

如何在JavaScript中查找到已知位置的距离

在浏览器中使用JavaScript,如何确定从当前位置到具有纬度和经度的其他位置的距离?

javascript gps distance geolocation latitude-longitude

17
推荐指数
1
解决办法
3万
查看次数

我该如何决定Tridion核心服务绑定的配额?

我使用System.ServiceModel.WsHttpBinding连接到Tridion核心服务.该服务仅供经过身份验证的用户使用,可能仅由我控制的代码使用.我必须为以下选择值

我看到的使用核心服务的代码示例总是将其中的一些设置为大于默认值的值,例如4Mb.这是因为在使用其他值(例如默认值)时存在已知问题吗?

MaxBufferPoolSize允许您防止过多的垃圾收集.这只是监控GC和基于此调整的问题吗?

MaxReceivedMessageSize,MaxArrayLength和MaxBytesPerRead可以防御Dos攻击,所以在我的场景中,也许我可以通过增加这些来提高吞吐量.真的有大量帮助吗?

MaxNameTableCharCount似乎是为了防止你可能不想不受控制地增长的东西的不受控制的增长,所以可能保留默认值是一件好事.

MaxStringContentLength上的文档未指定超出配额时会发生什么.据推测,ReadContentAsString会以某种方式失败,因此这个值可能很大.

那么 - 我应该将这些值保留为默认值吗?这会给我带来麻烦吗?我应该将它们增加到大值吗?这有助于吞吐量等,还是更有可能导致其他问题?

wcf tridion

14
推荐指数
2
解决办法
661
查看次数

发布多个项目时,SDL Tridion超时

使用SDL Tridion 2011 SP1时,当我们对多个项目执行任务时(例如,一次从一个文件夹发布1000个组件),我们有时会收到GUI错误.从同一列表中发布约100个项目非常有效.

我们在CME/GUI中看到的错误如下:

The transaction associated with the current connection has completed
but has not been disposed. The transaction must be disposed before the
connection can be used to execute SQL statements.
Run Code Online (Sandbox Code Playgroud)

Tridion错误日志中的Windows事件查看器中存在其他错误,如下所示:

The socket connection was aborted. This could be caused by an error processing 
    your message or a receive timeout being exceeded by the remote host, or an
    underlying network resource issue. Local socket timeout was
    '10675199.02:48:05.4775807'.
The read operation failed, see inner exception.
The socket …
Run Code Online (Sandbox Code Playgroud)

sql tridion tridion-2011

8
推荐指数
1
解决办法
2501
查看次数

什么编程实践导致Tridion报告在另一个线程上使用会话?

在我的Tridion内容管理服务器上检查事件日志时,(我正在使用2009版本),我看到警告说:

Session is used on another thread... than it was created on ... 
Session objects are not thread safe.
Run Code Online (Sandbox Code Playgroud)

什么编程/模板实践可能会导致这种情况?

编辑:到目前为止,我们有一些很好的建议:

  1. 不要将会话对象存储在静态变量中(Chris)
  2. 不要将引擎或包存储在静态变量中(Miguel)

事实上,这两个都是纯金,你应该检查自己的代码以获得这些反模式.(引擎有一个对会话的引用,所以这是有道理的.)尽管如此,我已经搜索了导致问题的代码库,但我还没有找到任何这些.那么 - 有没有人有更多的想法?我也欢迎有关如何调试此类事情或缩小有问题代码的建议.

tridion

8
推荐指数
3
解决办法
304
查看次数

在SiteEdit和Experience Manager之间进行选择的标准是什么

在Tridion 2011 SP1系统上,您可以选择实施SiteEdit 2009 SP3和更新的"SDL Tridion 2011 SP1用户界面更新"(也称为体验管理器).做出这个选择的重要标准是什么,为什么?

例如:

  1. 易于实施的成本
  2. 基础设施
  3. 许可费用
  4. 未来的支持
  5. 功能改进

tridion tridion-2011 siteedit

7
推荐指数
3
解决办法
431
查看次数

当DCP放在Tridion的页面上时,如何确保组件的所有动态渲染都与页面一起发布?

发布具有多个动态模板的组件通常会导致所有可能的动态组件演示发布到代理.

当您创建具有将项目放置在页面上的选项的DCT时,内容编辑器可能不希望直接发布组件,只需依靠页面发布来做正确的事情.我们可以考虑三种可能的期望发布方案:

  1. 发布页面应该只会导致静态组件呈现,(加上显示动态代码所需的任何CD代码)
  2. 除了静态CP之外,还应发布任何动态CP.不发布相同组件的其他可能的动态渲染.
  3. 如果发布动态CP,则遵循通常的组件发布语义,并且所有动态呈现都将发送到代理.

Tridion的默认行为似乎是场景2),而我的经验是,您经常想要的是场景3),为您提供CD侧任何给定组件的完整且一致的视图.

实现方案3的最佳方法是什么(包括取消发布以正常工作)?

tridion

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

如何按多个值对XML数据进行分组

我需要从XML分组"Document"值.问题是因为键值(productType)可以是多个.

这是XML:

<Documents>
<Document>
    <id>1</id>
    <title>title1</title>
    <productTypes>
        <productType id="x1">Capital Costs Analysis Forum - Brazil</productType>
  <productType id="x3">Environmental, Health and Safety &amp; Sustainability</productType>
    </productTypes>
</Document>
<Document>
    <id>2</id>
    <title>title2</title>
    <productTypes>
  <productType id="x1">Capital Costs Analysis Forum - Brazil</productType>
    </productTypes>
</Document>
<Document>
    <id>3</id>
    <title>title3</title>
    <productTypes>
  <productType id="x3">Environmental, Health and Safety &amp; Sustainability</productType>
    </productTypes>
</Document>
<Document>
    <id>4</id>
    <title>title4</title>
    <productTypes>
        <productType id="x2">Defense, Risk &amp; Security</productType>
    </productTypes>
</Document>
Run Code Online (Sandbox Code Playgroud)

这就是我尝试的:

var documents = from document in some.Descendants("Document")
                group document by (string)document
                    .Element("productTypes")
                    .Elements("productType")
                    .First() into docGroup
select docGroup;
Run Code Online (Sandbox Code Playgroud)

只有有一个productType元素,我的代码才有效.如果productType有多个值,如何更改我的代码?

.net c# xml linq linq-to-xml

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

在GetSystemWideList中使用PublishTransactionState过滤器不起作用

我在Core Service(SDL Tridion 2011 SP1)上使用GetSystemWideList操作时尝试为PublishTransactionState应用过滤器.

如果我尝试设置过滤器值,如PublishTransactionState.ScheduledForPublish或PublishTransactionState.WaitingForPublish,我得不到任何结果,即使我确定在队列中有这种状态的发布事务.

var filter = new PublishTransactionsFilterData {ForRepository = new LinkToRepositoryData {IdRef = "tcm:0-69-1"}};
filter.PublicationTarget = new LinkToPublicationTargetData { IdRef = "tcm:0-1-65537" };
filter.PublishTransactionState = PublishTransactionState.ScheduledForPublish;
//filter.StartDate = DateTime.Today.AddDays(-1);

var transactions = coreServiceSession.GetSystemWideList(filter);
Console.WriteLine(transactions.Count() + " publish transactions");
Run Code Online (Sandbox Code Playgroud)

启用filter.PublishTransactionState行后,核心服务始终返回0结果.通过此行注释,我们将按预期获取发布事务列表,其中包括一些状态为SceduledForPublish的事务.

其他过滤器,如StartDate过滤器按预期工作.

有人这个有用吗?

tridion tridion-2011

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