首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在ServiceStack上找不到给定键的错误

在ServiceStack上找不到给定键的错误
EN

Stack Overflow用户
提问于 2012-08-27 06:57:33
回答 1查看 1.4K关注 0票数 0

突然,我开始在我的ServiceStack MVC服务应用程序中遇到错误,如下所示:

{"The given key was not present in the dictionary."}    
System.Exception {System.Collections.Generic.KeyNotFoundException}

和StackTrace:

  at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at ServiceStack.WebHost.Endpoints.Utils.FilterAttributeCache.GetRequestFilterAttributes(Type requestDtoType) in C:\src\ServiceStack\src\ServiceStack\WebHost.Endpoints\Utils\FilterAttributeCache.cs:line 44
   at ServiceStack.WebHost.Endpoints.EndpointHost.ApplyRequestFilters(IHttpRequest httpReq, IHttpResponse httpRes, Object requestDto) in C:\src\ServiceStack\src\ServiceStack\WebHost.Endpoints\EndpointHost.cs:line 201
   at ServiceStack.WebHost.Endpoints.RestHandler.ProcessRequest(IHttpRequest httpReq, IHttpResponse httpRes, String operationName) in C:\src\ServiceStack\src\ServiceStack\WebHost.Endpoints\RestHandler.cs:line 79
   at ServiceStack.WebHost.Endpoints.Support.EndpointHandlerBase.ProcessRequest(HttpContext context) in C:\src\ServiceStack\src\ServiceStack\WebHost.Endpoints\Support\EndpointHandlerBase.cs:line 150
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

我不知道错误是什么,也不知道错误是什么。我的应用程序工作了,但现在不工作了。

你知道怎么解决这个问题吗?

编辑1:当我在When浏览器中浏览服务url时,调试器永远不会访问我的服务类和Run方法。

EN

回答 1

Stack Overflow用户

发布于 2012-09-10 13:09:39

我收到这个错误是因为在路由中使用了错误的模型。

所以:

Routes.Add<ModelA>("/path/to/service");

应该是

Routes.Add<ModelB>("/path/to/service");
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12134588

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档