草庐IT

the_menu

全部标签

c# - 电子邮件删除附件后,错误 "The process cannot access the file because it is being used by another process."

我正在做一个电子邮件表单。电子邮件有附件,并在附加文件后发送电子邮件。接下来需要从服务器删除文件。当我试图获取文件时,它给了我主题错误。我什至在删除文件之前调用了GC.Collect(),但错误仍然存​​在。我删除文件的代码是:privatevoidDeleteFiles(DataTabledt){GC.Collect();String[]sAttachments=newString[dt.Rows.Count];try{sAttachments=newString[dt.Rows.Count];for(Int32J=0;J要将文件附加到电子邮件,我的代码是:oMess.Subject

c# - Entity Framework new transaction is not allowed because there are other threads running in the session,多线程保存

我正在尝试将多线程进程的日志保存在数据库中,但出现以下错误:不允许新事务,因为session中还有其他线程在运行。在每个胎面我都有这个功能:internalboolWriteTrace(IResultresult,stringmessage,bytetype){SPC_SENDING_TRACEtrace=newSPC_SENDING_TRACE(message,Parent.currentLine.CD_LINE,type,Parent.currentUser.FULLNAME,Parent.guid);Context.SPC_SENDING_TRACE.AddObject(trac

c# - 使用 EF4(edmx 模型)时偶尔出现 "The underlying provider failed on Open"错误

我希望有人能帮我解决以下错误。发生错误的应用程序正在生产中运行,我自己从未遇到过错误。然而,我每天大约有20次收到错误邮件,告诉我:TheunderlyingproviderfailedonOpen.--->System.InvalidOperationException:Theconnectionwasnotclosed.Theconnection'scurrentstateisconnecting.这是堆栈跟踪System.Data.EntityException:TheunderlyingproviderfailedonOpen.--->System.InvalidOperati

c# - EF 5 代码迁移错误 : "There is already an object named _____ in the database"

在进行EF5代码迁移时遇到了一个反复出现的奇怪问题,现在让我无法工作。尝试运行update-database并收到此错误:Thereisalreadyanobjectnamed'RequestStatus'inthedatabase.详细的日志转储:PM>update-database-vUsingStartUpproject'LicensingWorkflow'.UsingNuGetproject'LicensingWorkflow'.Specifythe'-Verbose'flagtoviewtheSQLstatementsbeingappliedtothetargetdataba

c# - 从 ftp 服务器下载文件时为 "The underlying connection was closed"

我想从ftp服务器下载文件。我写了下面的代码来从ftp下载文件publicvoiddownloadFile(stringFTPAddress,stringfilename,stringusername,stringpassword,stringdestFile){try{FtpWebRequestrequest=FtpWebRequest.Create(FTPAddress+filename)asFtpWebRequest;request.Method=WebRequestMethods.Ftp.DownloadFile;request.Credentials=newNetworkCr

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# - 错误 :- The XmlReader state should be Interactive on XDocument. 加载

我收到以下错误:-System.InvalidOperationException:TheXmlReaderstateshouldbeInteractive.atSystem.Xml.Linq.XContainer.ReadContentFrom(XmlReaderr,LoadOptionso)atSystem.Xml.Linq.XDocument.Load(XmlReaderreader,LoadOptionsoptions)在下面的代码中。谁能指出我在这里做错了什么?staticXDocumentGetContentAsXDocument(stringxmlData){XmlDoc

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# - 被 "The remote server returned an error: (403) Forbidden"与 https 中的 WCF 服务难住了

我有一个WCF服务,由于这个错误,我已经将其归结为几乎没有。它把我逼上了墙。这就是我现在所拥有的。一个非常简单的WCF服务,具有一个返回值为“test”的字符串的方法。一个非常简单的Web应用程序,它使用该服务并将字符串的值放入标签中。在Win2003上使用SSL证书运行IIS6的Web服务器。同一服务器上其他可用的WCF服务。我将WCF服务发布到它的https位置我在VS中以Debug模式运行Web应用程序,它运行良好。我将Web应用程序发布到WCF服务所在的同一台服务器上的https位置,该服务器位于同一台SSL证书下我得到,“远程服务器返回错误:(403)禁止访问”我几乎更改了I

c# - TCP 错误代码 10061 : No connection could be made because the target machine actively refused it

很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visitthehelpcenter.关闭9年前。Couldnotconnecttonet.tcp://localhost:5051/user.Theconnectionattemptlastedforatimespanof00:00:02.0600206.TCPerrorcode10061:Noconnectioncouldbemadebecausethetargetmachineactivelyrefusedit127.0.0.1:5051.