Sitecore Web服务Url长度
因此,出于某种原因,sitecore似乎拒绝使用此url的较长版本Sitecore Web服务Url长度,sitecore,Sitecore,因此,出于某种原因,sitecore似乎拒绝使用此url的较长版本http://site1.com/sitecore%20modules/shell/service.svc/terms/a 要查找的所有新术语/,有错误: [ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length] System.String.InternalSubStringWithChecks(Int32 s
http://site1.com/sitecore%20modules/shell/service.svc/terms/a 要查找的所有新术语/
,有错误:
[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) +14652406
Sitecore.Web.RequestUrl.get_ItemPath() +157
Sitecore.Pipelines.HttpRequest.SiteResolver.GetItemPath(HttpRequestArgs args, SiteContext context) +55
Sitecore.Pipelines.HttpRequest.SiteResolver.UpdatePaths(HttpRequestArgs args, SiteContext site) +88
Sitecore.Pipelines.HttpRequest.SiteResolver.Process(HttpRequestArgs args) +75
(Object , Object[] ) +83
Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args) +191
Sitecore.Nexus.Web.HttpModule.(Object , EventArgs ) +457
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
但是urlhttp://site1.com/sitecore%20modules/shell/service.svc/terms/a 要查找的新术语/
似乎很有效。另外,当我在ignoreurlpeffix
中添加url时,它似乎完全失去了sitecore上下文
有什么想法吗?我也有同样的问题,如果我为我的webmethod选择一个简短的名称,它就可以工作了。使用长方法名时,我会遇到与您相同的错误 我没有找到这种行为的原因。 更新: 我向Sitecore支持部门询问了这个问题,他们向我发送了这个 这是他们提供的代码:
public class SiteResolver : SiteResolver
{
protected override void UpdatePaths(HttpRequestArgs args, SiteContext site)
{
if (!string.IsNullOrEmpty(HttpContext.Current.Request.PathInfo))
{
string filePath = args.Url.FilePath;
int length = filePath.LastIndexOf('.');
int num = filePath.LastIndexOf('/');
args.Url.ItemPath = length >= 0 ? (length >= num ? filePath.Substring(0, length) : filePath) : filePath;
}
args.StartPath = site.StartPath;
args.Url.ItemPath = this.GetItemPath(args, site);
site.Request.ItemPath = args.Url.ItemPath;
args.Url.FilePath = this.GetFilePath(args, site);
site.Request.FilePath = args.Url.FilePath;
}
}
要正常工作,IgnoreUrlPrefixes不应包含Asxm webservice路径,siteresolver配置必须为:
<processor type="Sitecore.Pipelines.HttpRequest.SiteResolver, Sitecore.Kernel">
<patch:attribute name="type">yourNamespace.CustomSiteResolver,yourAssembly</patch:attribute>
</processor>
yourNamespace.CustomSiteResolver,yourAssembly
当我将其包含在IgnoreUrlPrefixes中时,我似乎失去了sitecore上下文。我将服务放在sitecore模块文件夹中,以便获取sitecore上下文。这是修补的正确方法吗?我看到了配置错误。不管怎样,我已经解决了。谢谢你的帮助。这似乎工作得很好!您是否在web.config中,在requestFiltering或服务绑定中设置了url的最大长度?如果将服务移动到根文件夹并发出相同的请求,会发生什么情况?requestFiltering设置为错误来自Sitecore SiteResolver,因此我假设服务绑定与此无关?如果将其移动到根文件夹,它将工作,但会丢失Sitecore上下文。