草庐IT

current_client

全部标签

c# - LINQ to Entities/LINQ to SQL : switching from server (queryable) to client (enumerable) in the middle of a query comprehension?

在许多情况下,我想在服务器端进行一些过滤(有时是投影),然后切换到客户端以执行LINQ提供程序本身不支持的操作。天真的方法(这基本上就是我现在所做的)是将其分解为多个查询,类似于:varfromServer=fromtincontext.Tablewheret.Col1=123wheret.Col2="blah"selectt;varclientSide=fromtinfromServer.AsEnumerable()wheret.Col3.Split('/').Last()=="whatever"selectt.Col4;但是,很多时候,这带来的代码/麻烦多于它的实际值(value)

c# - 测试使用 HttpContext.Current.Request.Files 的 Web API 方法?

我正在尝试为使用HttpContext.Current.Request.Files的WebAPI方法编写测试,经过详尽的搜索和实验后,我无法弄清楚如何模拟它。正在测试的方法如下所示:[HttpPost]publicHttpResponseMessagePost(){varrequestFiles=HttpContext.Current.Request.Files;varfile=requestFiles.Get(0);//dosomeotherstuff...}我意识到有otherquestionssimilartothis,但他们没有解决这个具体情况。如果我尝试模拟上下文,我会遇到H

c# - RabbitMQ 持久队列不工作(RPC-Server,RPC-Client)

我想知道为什么我的RabbitMQRPC-Client在重启后总是处理死消息。_channel.QueueDeclare(queue,false,false,false,null);应该禁用缓冲区。如果我在RPC客户端中重载QueueDeclare,我将无法连接到服务器。这里有什么问题吗?知道如何解决这个问题吗?RPC-服务器newThread(()=>{varfactory=newConnectionFactory{HostName=_hostname};if(_port>0)factory.Port=_port;_connection=factory.CreateConnectio

c# - HttpContext.Current.Request.UserHostAddress 为空

在我的开发机器中HttpContext.Current.Request.UserHostAddress为空。为什么?我怎样才能打开它?如果是代理客户端,如何获取Ips列表?WCF服务与ASP.net4window7。谢谢 最佳答案 为避免此问题,您可以解析最后输入IP的HTTP_X_FORWARDED_FOR。ip=Request.ServerVariables["HTTP_X_FORWARDED_FOR"];if(!string.IsNullOrEmpty(ip)){string[]ipRange=ip.Split(',');in

c# - "The breakpoint will not currently be hit. A copy of file was found in dll file, but the current source code is different"

我不断收到此错误消息,提示存在.cs文件的副本,因此不会命中断点。我尝试过清理解决方案、重建、删除obj和bin文件夹中的.pdb文件、关闭VS并重新启动它、重新启动整个机器(这是Windows!有时最复杂、无法解释的问题会像这样解决:\)知道我还能尝试什么吗?这是VS2015上的.net项目 最佳答案 我发现了问题,原来IIS配置为使用我备份文件夹中项目的不同副本。这听起来很傻,但如果有人有类似的问题,我会保留这个问题。 关于c#-"Thebreakpointwillnotcurren

c# - 异步任务中的 HttpContext.Current null

我有一个使用存储库的方法(userRepo):publicoverrideTaskCreateLocalUserAsync(IUseruser,stringpassword,CancellationTokencancellationToken){vartask=newTask(()=>{TUserEntitynewUser=newTUserEntity{Id=user.Id,UserName=user.UserName,Password=password};userRepo.Save(newUser).Flush();returnnewIdentityResult(true);},ca

c# - HttpContext.Current.Cache 是线程安全的吗?

请检查下面的代码:objDDLTable=HttpContext.Current.Cache["TestSet"]asHashtable;if(objDDLTable==null){objDDLTable=newHashtable();arrDDLItems=GetDropDownList("testDropDown");objDDLTable.Add("testDropDown",arrDDLItems);HttpContext.Current.Cache["TestSet"]=objDDLTable;}elseif(objDDLTable!=null&&!objDDLTable.C

c# - 使用最小起订量模拟 HttpContext.Current.Server.MapPath?

我正在对我的家庭Controller进行单元测试。在我添加保存图像的新功能之前,此测试运行良好。导致问题的方法如下所示。publicstaticvoidSaveStarCarCAPImage(intcapID){byte[]capBinary=Motorpoint2011Data.RetrieveCapImageData(capID);if(capBinary!=null){MemoryStreamioStream=newMemoryStream();ioStream=newMemoryStream(capBinary);//savethememorystreamasanimage//

c# - LinqToSQL 错误 : Operation is not valid due to the current state of the object

在更新命令期间,我收到以下错误:Operationisnotvalidduetothecurrentstateoftheobject我试图从更新命令中删除一列并且它工作正常。此列是一个FK,与其他工作正常的FK相似。这是执行更新的代码:ti.NumeroTitolo=titolo.Numero;ti.RKTipoTitoloGenereTitolo=titolo.RkTipoTitoloGenereTitolo;ti.RKBanca=titolo.RkBanca;ti.DataScadenza=titolo.DataScadenza;ti.RKTipoEsito=titolo.RkTi

c# - 从代码发送电子邮件时出现“5.7.1 Client does not have permission”错误

所以我有一个非常基本的程序试图发送电子邮件,但我一直收到Mailboxunavailable.Theserverresponsewas:5.7.1Clientdoesnothavepermissionstosendasthissender这是我的程序staticvoidMain(string[]args){SmtpClientclient=newSmtpClient("Server",25);client.UseDefaultCredentials=false;client.DeliveryMethod=SmtpDeliveryMethod.Network;client.Credent