草庐IT

subject-alternative-name

全部标签

c# - "The type or namespace name ' 使用 ' could not be found"路由 "attribute routing"

只是试图将一些代码从一个工作项目拼接到另一个。“from”项目使用“属性路由”,您可以在WebAPIController模块中嵌入[Route(…)]指令来指示应该将哪个HTTP消息路由到哪个服务例程。在“from”项目中工作正常,但在“to”项目中我收到构建错误“找不到类型或namespace名称‘Route’(是否缺少using指令或程序集引用?)"我已经尝试将“from”项目中的所有using语句基本上复制到“to”项目中,但这没有明显效果。没有任何MS文档表明需要NuGet包(甚至是using语句)。这两个项目都应该是ASP.NETMVC4。(是的,我用config.MapHt

c# - 无法添加类型为 'filter' 且唯一键属性 'name' 设置为 'ASP.Net_4.0_64bit' 的重复集合条目

我遇到这个问题已经有一段时间了。当我打开一个指向我的本地主机的asp.net页面时,就会发生这种情况。我正在运行带有visualstudio2012和iis7.5的Windows2008r2。它显示的配置源是这样的。:1451:1452:1453:它表明它在第1452行出错。最初,这是inetsrv32位和64位位置的applicationHost.config文件中的一个问题。我进去并删除了重复的4.0条目,它工作了好几个月。然后它又开始抛出这个错误。那时我刚刚完全重新安装了IIS,我的应用程序又开始工作了。此错误再次开始出现,我再次执行了IIS的完全重新安装,但这次没有帮助,我的应

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# - "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# - CA1819 : Properties shouldn't return arrays - What is the right alternative?

我以前遇到过这个FxCop规则,但对如何解决违规问题并不满意(thread1、thread2)。我现在有另一个案例,我需要纠正违反CA1819的行为亲切。具体来说,我有一个算法库,它使用如下所示的公共(public)“输入对象”对曲线(x,y)执行一些分析计算:publicclassInputObject{publicdouble[]X{get;set;}publicdouble[]Y{get;set;}//+lotsofotherthingswell}此对象的X和Y属性在库中的数百个位置使用,通常使用索引。输入对象永远不会被算法改变,但实际上如果是这样也无关紧要。另外,.Length

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# - Entity Framework : Alternate solution to using non primary unique keys in an association

我知道EntityFramework不允许您使用非主唯一键作为外键关联从数据库生成模型。我可以手动修改EDMX吗?如果是这样,有人可以给我一个例子或引用吗?如果不是,还有其他可能吗?最简单的例子:这是表的DDL。您会注意到我有一个从PersonType.TypeCode到Person.TypeCode的外键CREATETABLE[dbo].[PersonType]([PersonTypeId][int]NOTNULL,[TypeCode][varchar](10)NOTNULL,[TypeDesc][varchar](max)NULL,CONSTRAINT[PK_PersonType]

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# - 如何使用 Name 属性枚举 .NET 中的线程?

假设我像这样启动两个线程://StartfirstthreadThreadloaderThread1=newThread(loader.Load);loaderThread1.Name="Rope";loaderThread1.Start();//StartsecondthreadThreadloaderThread2=newThread(loader.Load);loaderThread2.Name="String";loaderThread2.Start();有什么方法可以通过使用它们的Name属性来枚举线程?我想检查具有特定名称的线程是否仍在运行。我创建的每个线程都处理一组命名的