草庐IT

module_has_competence

全部标签

c# - 跨线程操作无效(How to access WinForm elements from another module events?)

我有一个带有串行端口信号事件的模块serialPort.DataReceived.AddHandler(SerialDataReceivedEventHandler(DataReceived));DataReceived在哪里letDataReceivedab=rxstringProcessData正在调用WinForms方法letProcessData(a,b)=dataProcessor.Invoke(a,b)|>ignore这是privatevoidProcessData(objectsender,EventArgse){byte[]m=Core.ncon.ArrayRead;s

c# -/平台 :anycpu32bitpreferred is not a valid setting for option/target:library or/target:module

我创建了一个Windows服务项目,后来决定将其输出类型更改为类库,这样我就可以将服务类包含在另一个项目中,该项目将创建要作为服务安装的.exe。但是现在,当我尝试构建第一个项目时,它失败并出现错误:/platform:anycpu32bitpreferredisnotavalidsettingforoption/target:libraryor/target:module我该如何解决这个问题? 最佳答案 尝试卸载项目(在解决方案资源管理器中右键单击)编辑.csproj(右键单击解决方案资源管理器)删除true重新加载项目。

c# - C#.NET 中的 DDD "Module"

在Evan的DDD书中,他谈到了使用“模块”隔离域中的概念。术语“模块”在软件开发中可以被翻译成许多不同的东西,包括概念上的和具体的,所以我想知道DDD模块的概念如何在C#.NET系统中表达,以及是否存在任何直接关联软件开发中术语“模块”的其他用途(例如,Evans提到一些开发人员将DDD模块表示为Java包,我认为这类似于.NET程序集)。我认为,您可以使用单独的.NET程序集或命名空间(这就是我们现在正在做的事情)从字面上表达这个概念。我们计划减少解决方案中的项目数量以缩短构建时间,因此我对如何将此概念应用于单个程序集非常感兴趣。 最佳答案

c# - 如何在没有 "process has exited"异常的情况下终止进程?

我使用Process.Kill()来终止进程。像这样:if(!process.WaitForExit(5000)){process.Kill();}有时进程会在两行之间退出,所以控制会进入if然后Kill会产生异常:System.InvalidOperationExceptionCannotprocessrequestbecausetheprocess(ProcessIdHere)hasexited.atSystem.Diagnostics.Process.GetProcessHandle(Int32access,BooleanthrowIfExited)atSystem.Diagno

c# - "Service X has zero application endpoints"除非我在代码中添加端点 - 为什么?

我关注了thisMSDNarticle彻底创建托管在托管NT服务中的WCF服务。当我在服务控制台中单击“开始”时,我会在事件查看器中看到以下内容:Servicecannotbestarted.System.InvalidOperationException:Service'MyServiceNamespace.RequestProcessorImpl'haszeroapplication(non-infrastructure)endpoints.Thismightbebecausenoconfigurationfilewasfoundforyourapplication,orbecau

c# - linq-to-sql "Cannot remove an entity that has not been attached"

当我尝试删除记录时出现错误Cannotremoveanentitythathasnotbeenattached.。我四处搜索,虽然有很多地方可以找到解决这个问题的方法,但建议的修复方法并没有让我更进一步:using(MyDataContextTheDC=newMyDataContext()){TheDC.MyTable.Attach(ARecord);//addedthislinebutdoesn'tfixit.TheDC.MyTable.DeleteOnSubmit(ARecord);TheDC.SubmitChanges();我更大的问题是:这个问题只影响删除查询还是影响其他类型的

c# - AngularJS 与 Asp.net Web API : $http post returning XMLHttpRequest cannot load: Response for preflight has invalid HTTP status code 405

当尝试使用$http将jsonPOST到Asp.netwebAPI服务器时,它返回以下错误XMLHttpRequestcannotloadhttp://localhost:62158/api/video/add.ResponseforpreflighthasinvalidHTTPstatuscode405但是从$.ajax发出相同的请求是工作文件。$HTTP代码$http.post(url,data,config).success(function(data,status,headers,config){defered.resolve(data);}).error(function(d

c# - "StandardOut has not been redirected or the process hasn' t started yet”在 C# 中读取控制台命令输出时

感谢@user2526830提供的代码。基于该代码,我在程序中添加了几行,因为我想读取SSH命令的输出。下面是我的代码,它在while行出错StandardOuthasnotbeenredirectedortheprocesshasn'tstartedyet.我想要实现的是,我想将ls的输出读入一个字符串。ProcessStartInfostartinfo=newProcessStartInfo();startinfo.FileName=@"f:\plink.exe";startinfo.Arguments="-sshabc@x.x.x.x-pwabc123";Processproce

c# - System.Net.Mail.SmtpException : The operation has timed out. 错误在asp.net发送邮件代码使用godaddy托管

我正在使用以下代码和平使用godaddy托管发送邮件。但它抛出System.Net.Mail.SmtpException:Theoperationhastimedout.protectedvoidsendmail(){varfromAddress="frommailid@site.com";//anyaddresswheretheemailwillbesendingvartoAddress="to@gmail.com";//PasswordofyourgmailaddressconststringfromPassword="mypassword";//Passingthevaluesa

c# - SignalR 2.1.0 : The connection has not been established

我有一个ASP.NETWeb应用程序,其中包含一个简单的HTML页面和一些通过SignalR进行通信的JavaScript。那很好用。现在,我正在尝试从另一个项目(在同一解决方案中)调用Hub上的方法并使用.NETSignalrClientApi:varconnection=newHubConnection("http://localhost:32986/");varhub=connection.CreateHubProxy("MessageHub");connection.Start();hub.Invoke("SendMessage","","");最后一行导致InvalidOpe