草庐IT

sd_bus_request_name

全部标签

c# - WebApi 服务中的 [FromUri] 属性忽略了 DataMember 的 Name 属性

我们正在使用Asp.NetWebApi创建RestService。但由于某种原因,当尝试使用[FromURI]属性反序列化复杂属性时,Name属性在DataMember属性中被忽略。例如我们可能有:方法:publicIHttpActionResultGet([FromUri]Useruser)型号:[DataContract]publicclassUser{[DataMember(Name="username")]publicstringUsername{get;set;}[DataMember(Name="isActive",IsRequired=false)]publicbool?

c# - fiddler /C# : search content of request/response for special phrases

这是我第一次访问stackoverflow,现在我对这个网站感到非常满意。它已经帮助我获得了FiddlerCore嵌入到MSVisualC#2008ExpressEdition中。只需要在MSVisualC#EE中从项目资源管理器(Projektmappenexplorer)创建对fiddlercoredll的引用(Verweis)。希望这是它在英文版中的名称。在此之后,您可以使用Fiddler.FiddlerApplication等。我的任务是什么?我想创建一个小程序,它能够使用FiddlerCore检查特殊JavaScript代码的请求/响应主体。这使开发人员能够检查他们的代码在其

c# - Request.Url.Query 和 Request.QueryString 有什么区别?

我一直在追踪一个关于UrlRewriting应用程序的错误。该错误表现为查询字符串中某些变音符号的编码问题。基本上,问题是基本上是/search.aspx?search=heřmánek的请求被重写为“search=he%c5%99m%c3%a1nek”的查询字符串正确的值(使用一些不同的工作代码)是将查询字符串重写为“search=he%u0159m%u00e1nek”注意两个字符串之间的区别。但是,如果您将两者都发布,您将看到Url编码重现相同的字符串。直到您使用context.Rewrite函数,编码才会中断。损坏的字符串返回“heÅmánek”(使用Request.QueryS

c# - "Assembly Same Simple Name already been imported"错误

这是一个CLR项目。我正在导入两个同名的DLL文件,quizz.dll(我将旧版本重命名为legacyquizz.dll),并将新版本包含为quizz.dll到遗留转换器测试项目。(正在测试的遗留转换器项目仅导入旧的quizz.dll)。这是我遇到的错误。..Anassemblywiththesamesimplename'Quizz,Version=2.0.0.1,Culture=neutral,PublicKeyToken=nullhasalreadybeenimported.Tryremovingoneofthereferencesorsignthemtoenableside-by

c# - 调用 HttpContext.Request 时如何避免 HttpException?

所以HttpContext.Request如果在全局启动内调用则抛出publicHttpRequestget_Request(){if(this.HideRequestResponse){thrownewHttpException(SR.GetString("Request_not_available"));}returnthis._request;}这实际上是有记录的ASP.NETwillthrowanexceptionifyoutrytousethispropertywhentheHttpRequestobjectisnotavailable.Forexample,thiswoul

c# - 尝试打开 telerik 报告时出现 "Value cannot be null. Parameter name: instance"错误

在我的解决方案中,我有telerik报告,当尝试在VisualStudio2010设计器中打开它们时,我收到此错误:Valuecannotbenull.Parametername:instanceCallStackatSystem.ComponentModel.TypeDescriptor.AddAttributes(Objectinstance,Attribute[]attributes)atMicrosoft.VisualStudio.Design.VSDesignSurface.CreateDesigner(IComponentcomponent,BooleanrootDesig

c# - 值不能为空。参数名称 : request

我正在使用nunit创建单元测试,所有这些代码在运行时都运行良好。我在下面有这个protectedHttpResponseMessage代码,当它返回时我的Controller正在调用它。但是,报错:"Valuecannotbenull.Parametername:request"isdisplaying.当我检查请求时,它实际上是null。问题:我将如何编写单元测试代码以返回HttpResponseMessage?错误显示在这一行:protectedHttpResponseMessageCreated(Tresult)=>Request.CreateResponse(HttpStat

c# - ASP.net Web API : change class name when serializing

我有一个产品的数据传输对象类publicclassProductDTO{publicGuidId{get;set;}publicstringName{get;set;}//Otherproperties}当Asp.net序列化JSON(使用JSON.NET)或XML中的对象时,它会生成ProductDTO对象。但是,我想在序列化期间更改名称,从ProductDTO到Product,使用某种属性:[Name("Product")]publicclassProductDTO{[Name("ProductId")]publicGuidId{get;set;}publicstringName{

c# - SQL 服务器 : invalid object name in query execution

我正在尝试执行Insert语句,但一直收到Invalidobjectname错误。这是我的代码:publicstringaddNewComment(intuserID,intpageID,stringtitle,stringcomment){stringquery="INSERTINTOdbo.nokernok_kommentarer(userID,pageID,commentTitle,comment)"+"VALUES("+userID+","+pageID+",'"+title+"','"+comment+"')";adapter.InsertCommand=newSqlComm

c# - 检查 Request.IsAjaxRequest 在我的 asp.net mvc4 中总是返回 false

我的Controller中有以下代码publicActionResultIndex(stringsearchTerm=null){System.Threading.Thread.Sleep(5000);varaccountdefinition=repository.FindAccountDefinition(searchTerm).ToList();if(Request.IsAjaxRequest()){returnPartialView("_CustomerTable",accountdefinition);}returnView(accountdefinition);}但如果我使用