.net framework
104 TopicsWindows Server 2019 Cannot Install .NET 3.5
I am running Windows Server 2019 (Version 1809, Build 17763.4499) and I cannot install .NET Framework 3.5. Below is the current installation status of the feature on my machine: PS > Get-WindowsFeature -Name NET-Framework-Features,NET-Framework-Core,NET-HTTP-Activation,NET-Non-HTTP-Activ Display Name Name Install State ------------ ---- ------------- [X] .NET Framework 3.5 Features NET-Framework-Features Installed [ ] .NET Framework 3.5 (includes .NET 2.0 and 3.0) NET-Framework-Core Removed [ ] HTTP Activation NET-HTTP-Activation Removed [ ] Non-HTTP Activation NET-Non-HTTP-Activ Removed Through hours of searching online I have not been able to discover a resolution to the issue I am seeing. I followed the installation steps in https://woshub.com/how-to-install-net-framework-3-5-on-windows/ as this was the most complete guide. None of the suggested installation methods worked. Via Server Manager: Add roles and features -> Features -> .NET Framework 3.5 Features -> .NET Framework 3.5 (includes .NET 2.0 and 3.0 ); Using DISM: DISM /Online /Enable-Feature /FeatureName:NetFx3 /All Using DISM: DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /Source:D:\sources\sxs /LimitAccess With PowerShell: Install-WindowsFeature -Name NET-Framework-Core With PowerShell: Install-WindowsFeature -Name NET-Framework-Core -Source D:\Sources\SxS With DISM: DISM /online /Add-Package /PackagePath:D:\Sources\SxS\microsoft-windows-netfx3-ondemand-package~31bf3856ad364e35~amd64~~.cab I also tried using the offline packages from my installation media without success. And when trying to use GPO to force installation from / prohibit installation from Windows Update (non-WSUS) I did not see any results. Regardless which method I use, I end up getting the same 0x800f0800 error. I've only come across https://social.technet.microsoft.com/Forums/windowsserver/en-US/5be0b03c-f499-4530-837d-76eacb4f1473/net-framework-35-cannot-install when trying to install a Windows feature, but their resolution was just rebuilding their server. This is not a viable option for my scenario. The full error from PowerShell is displayed below: PS> Install-WindowsFeature -Name NET-Framework-Core -Source D:\Sources\SxS Install-WindowsFeature : The request to add or remove features on the specified server failed. Installation of one or more roles, role services, or features failed. Error: 0x800f0800 At line:1 char:1 + Install-WindowsFeature -Name NET-Framework-Core -Source D:\Sources\SxS + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (@{Vhd=; Credent...Name=localhost}:PSObject) [Install-WindowsFeature], Exception + FullyQualifiedErrorId : DISMAPI_Error__Failed_To_Enable_Updates,Microsoft.Windows.ServerManager.Commands.AddWind owsFeatureCommand Any help on this issue is greatly appreciated! Crosspost: https://serverfault.com/questions/1134449/windows-server-2019-cannot-install-net-3-545KViews0likes6CommentsHow to add a timer to C# Service
Hi everyone I am new to coding in c # and trying to write a windows service in c #, my service seems to be working fine except for one thing: I try to make it run in a loop, say every 30 seconds, another program. But for the moment when I launch my service, it executes the program only once. My code: using System; using System.Runtime.InteropServices; using System.Diagnostics; // SET STATUS using System.ComponentModel;// SET STATUS using System.ServiceProcess; using System.Timers; //using System.ServiceProccess;// SET STATUS public enum ServiceType : int { // SET STATUS [ SERVICE_WIN32_OWN_PROCESS = 0x00000010, SERVICE_WIN32_SHARE_PROCESS = 0x00000020, }; // SET STATUS ] public enum ServiceState : int { // SET STATUS [ SERVICE_STOPPED = 0x00000001, SERVICE_START_PENDING = 0x00000002, SERVICE_STOP_PENDING = 0x00000003, SERVICE_RUNNING = 0x00000004, SERVICE_CONTINUE_PENDING = 0x00000005, SERVICE_PAUSE_PENDING = 0x00000006, SERVICE_PAUSED = 0x00000007, }; // SET STATUS ] [StructLayout(LayoutKind.Sequential)] // SET STATUS [ public struct ServiceStatus { public ServiceType dwServiceType; public ServiceState dwCurrentState; public int dwControlsAccepted; public int dwWin32ExitCode; public int dwServiceSpecificExitCode; public int dwCheckPoint; public int dwWaitHint; }; // SET STATUS ] public enum Win32Error : int { // WIN32 errors that we may need to use NO_ERROR = 0, ERROR_APP_INIT_FAILURE = 575, ERROR_FATAL_APP_EXIT = 713, ERROR_SERVICE_NOT_ACTIVE = 1062, ERROR_EXCEPTION_IN_SERVICE = 1064, ERROR_SERVICE_SPECIFIC_ERROR = 1066, ERROR_PROCESS_ABORTED = 1067, }; public class Service_PSTest : ServiceBase { // PSTest may begin with a digit; The class name must begin with a letter private System.Diagnostics.EventLog eventLog; // EVENT LOG private ServiceStatus serviceStatus; // SET STATUS public Service_PSTest() { ServiceName = "Test2"; CanStop = true; CanPauseAndContinue = false; AutoLog = true; eventLog = new System.Diagnostics.EventLog(); // EVENT LOG [ if (!System.Diagnostics.EventLog.SourceExists(ServiceName)) { System.Diagnostics.EventLog.CreateEventSource(ServiceName, "Application"); } eventLog.Source = ServiceName; eventLog.Log = "Application"; // EVENT LOG ] EventLog.WriteEntry(ServiceName, "Test2.exe Test2()"); // EVENT LOG } [DllImport("advapi32.dll", SetLastError = true)] // SET STATUS private static extern bool SetServiceStatus(IntPtr handle, ref ServiceStatus serviceStatus); protected override void OnStart(string[] args) { EventLog.WriteEntry(ServiceName, "Test2.exe OnStart() // Entry. Starting script 'c:\\temp\\Test.exe\\Test1.ps1' -SCMStart"); // EVENT LOG // Set the service state to Start Pending. // SET STATUS [ // Only useful if the startup time is long. Not really necessary here for a 2s startup time. serviceStatus.dwServiceType = ServiceType.SERVICE_WIN32_OWN_PROCESS; serviceStatus.dwCurrentState = ServiceState.SERVICE_START_PENDING; serviceStatus.dwWin32ExitCode = 0; serviceStatus.dwWaitHint = 2000; // It takes about 2 seconds to start PowerShell SetServiceStatus(ServiceHandle, ref serviceStatus); // SET STATUS ] // Start a child process with another copy of this script try { Process p = new Process(); // Redirect the output stream of the child process. p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "PowerShell.exe"; p.StartInfo.Arguments = "-ExecutionPolicy Bypass -c & 'c:\\temp\\Test.exe\\Test1.ps1' -SCMStart"; // Works if path has spaces, but not if it contains ' quotes. p.Start(); // Read the output stream first and then wait. (To avoid deadlocks says Microsoft!) string output = p.StandardOutput.ReadToEnd(); // Wait for the completion of the script startup code, that launches the -Service instance p.WaitForExit(); if (p.ExitCode != 0) throw new Win32Exception((int)(Win32Error.ERROR_APP_INIT_FAILURE)); // Success. Set the service state to Running. // SET STATUS serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING; // SET STATUS } catch (Exception e) { EventLog.WriteEntry(ServiceName, "Test2.exe OnStart() // Failed to start 'c:\\temp\\Test.exe\\Test1.ps1' " + e.Message, EventLogEntryType.Error); // EVENT LOG // Change the service state back to Stopped. // SET STATUS [ serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED; Win32Exception w32ex = e as Win32Exception; // Try getting the WIN32 error code if (w32ex == null) { // Not a Win32 exception, but maybe the inner one is... w32ex = e.InnerException as Win32Exception; } if (w32ex != null) { // Report the actual WIN32 error serviceStatus.dwWin32ExitCode = w32ex.NativeErrorCode; } else { // Make up a reasonable reason serviceStatus.dwWin32ExitCode = (int)(Win32Error.ERROR_APP_INIT_FAILURE); } // SET STATUS ] } finally { serviceStatus.dwWaitHint = 0; // SET STATUS SetServiceStatus(ServiceHandle, ref serviceStatus); // SET STATUS EventLog.WriteEntry(ServiceName, "Test2.exe OnStart() // Exit"); // EVENT LOG } } protected override void OnStop() { EventLog.WriteEntry(ServiceName, "Test2.exe OnStop() // Entry"); // EVENT LOG // Start a child process with another copy of ourselves try { Process p = new Process(); // Redirect the output stream of the child process. p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "PowerShell.exe"; p.StartInfo.Arguments = "-ExecutionPolicy Bypass -c & 'c:\\temp\\Test.exe\\Test1.ps1' -SCMStop"; // Works if path has spaces, but not if it contains ' quotes. p.Start(); // Read the output stream first and then wait. (To avoid deadlocks says Microsoft!) string output = p.StandardOutput.ReadToEnd(); // Wait for the PowerShell script to be fully stopped. p.WaitForExit(); if (p.ExitCode != 0) throw new Win32Exception((int)(Win32Error.ERROR_APP_INIT_FAILURE)); // Success. Set the service state to Stopped. // SET STATUS serviceStatus.dwCurrentState = ServiceState.SERVICE_STOPPED; // SET STATUS } catch (Exception e) { EventLog.WriteEntry(ServiceName, "Test2.exe OnStop() // Failed to stop 'c:\\temp\\Test.exe\\Test1.ps1'. " + e.Message, EventLogEntryType.Error); // EVENT LOG // Change the service state back to Started. // SET STATUS [ serviceStatus.dwCurrentState = ServiceState.SERVICE_RUNNING; Win32Exception w32ex = e as Win32Exception; // Try getting the WIN32 error code if (w32ex == null) { // Not a Win32 exception, but maybe the inner one is... w32ex = e.InnerException as Win32Exception; } if (w32ex != null) { // Report the actual WIN32 error serviceStatus.dwWin32ExitCode = w32ex.NativeErrorCode; } else { // Make up a reasonable reason serviceStatus.dwWin32ExitCode = (int)(Win32Error.ERROR_APP_INIT_FAILURE); } // SET STATUS ] } finally { serviceStatus.dwWaitHint = 0; // SET STATUS SetServiceStatus(ServiceHandle, ref serviceStatus); // SET STATUS EventLog.WriteEntry(ServiceName, "Test2.exe OnStop() // Exit"); // EVENT LOG } } public static void Main() { Timer timer = new Timer(); // name space(using System.Timers;) void OnElapsedTime(object source, ElapsedEventArgs e) { System.ServiceProcess.ServiceBase.Run(new Service_PSTest()); } timer.Elapsed += new ElapsedEventHandler(OnElapsedTime); timer.Interval = 5000; //number in milisecinds timer.Enabled = true; } } Help will be welcome16KViews0likes2CommentsHow to Resolve .NET Runtime Error 1026 after Windows 11 Update
I hope you're doing well. I am a teacher from Mexico and I'm facing a critical issue after a recent Windows 11 update to version 23H2. Ever since the update, I've been encountering a frustrating problem – a .NET Runtime Error 1026. This issue is causing applications to crash shortly after I launch them, making it impossible for me to access Mi Portal. Given that I heavily rely on Windows applications for my teaching tasks – from document editing to publications and printing, including crucial tasks like payslips handling – this situation has left me unable to perform my duties effectively. I understand that many educators are in a similar situation, where Windows OS and Office applications are our lifelines for seamless work. I urgently need a simple and effective solution to overcome this error and restore the functionality of my Windows 11 system. Your expertise and support in troubleshooting this .NET Runtime Error 1026 would be immensely appreciated. If anyone has encountered a similar issue or has successfully resolved it, I would be grateful for your insights. I need guidance or steps you can provide to help me swiftly resolve this issue and continue my teaching job without further disruptions. Warm regards and appreciation12KViews1like1CommentError -another entity of the same type already has the same primary key value
Good afternoon, I have an error, and I think you can help me. Error in Microsoft Visual Studio (Microsoft .NET Framework Version 4.8, EntityFramework 6.2): " System.InvalidOperationException HResult=0x80131509 Message=Attaching an entity of type 'SGI2DataAccess.Models.ProjectForecast' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate. Source=EntityFramework StackTrace: at System.Data.Entity.Core.Objects.ObjectContext.VerifyRootForAdd(Boolean doAttach, String entitySetName, IEntityWrapper wrappedEntity, EntityEntry existingEntry, EntitySet& entitySet, Boolean& isNoOperation) at System.Data.Entity.Core.Objects.ObjectContext.AttachTo(String entitySetName, Object entity) at System.Data.Entity.Internal.Linq.InternalSet`1.<>c__DisplayClassa.<Attach>b__9() at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName) at System.Data.Entity.Internal.Linq.InternalSet`1.Attach(Object entity) at System.Data.Entity.DbSet`1.Attach(TEntity entity) at SGI2.Data.Infrastructure.RepositoryBase`1.Update(T entity) in C:\work\sgi\SGI2.Data\Infrastructure\RepositoryBase.cs:line 41 at SGI2.Service.Services.Projects.ForecastProject.UpdateForecast(List`1 forecasts, ProjetoVM Projeto) in C:\work\sgi\SGI2.Service\Services\Projects\ForecastProject.cs:line 79 at SGI2.Service.ProjetosService.UpdateProjeto(ProjetoEditVM VM, Int32 userId, String userNomeConhecido) in C:\work\sgi\SGI2.Service\Services\Projects\ProjetosService.cs:line 1212 at SGI2.Controllers.ProjetosController.Edit(ProjetoEditVM VM, String Command) in C:\work\sgi\SGI2\SGI2\Controllers\Projeto\ProjetosController.cs:line 312 at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End() at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() " Code: object: \sgi2\SGI2\Controllers\Projeto\ProjetosController.cs (...) // Interface private readonly IProjetosService _service; (...) [HttpPost] [ValidateAntiForgeryToken] public ActionResult Edit(ProjetoEditVM VM, string Command) { #region PERMISSOES if (!ClaimsAuthorization.CheckAccess("generic-editprojetos", VM.Projeto.Id.ToString(), VM.Projeto.EstadoId.ToString())) return new HttpStatusCodeResult(HttpStatusCode.Forbidden); // Completed projects should never be able to be edited if (_service.GetProjeto(VM.Projeto.Id).EstadoId == 2) return new HttpStatusCodeResult(HttpStatusCode.Forbidden); #endregion else if (ModelState.IsValid) { if (VM.Projeto.EstadoId == 2 && (VM.Projeto.TipoId == 8 || VM.Projeto.TipoId == 9) && !_service.GetAllProjetosPPRInfo(x => x.ProjetoId == VM.Projeto.Id && x.IsTheLast).Any()) { return RedirectToAction("Edit", new { Id = VM.Projeto.Id, param = "CloseProjectLastPPRInfoError" }); } // Se vem do botão "Refresh Forecast", atualizar valores, antes de submeter com valores desatualizados if (Command == "RefreshForecastButton") { _service.UpdateProjetoRF(VM, UserId, UserNomeConhecido); // ok RefreshForecastButton(VM, Command, UserId, UserNomeConhecido); _service.UpdateProjeto(VM, UserId, UserNomeConhecido); // NOT ok } (...) } (...) } (...) object: \sgi\SGI2.Service\Services\Projects\ProjetosService.cs public void UpdateProjeto(ProjetoEditVM VM, int userId, string userNomeConhecido) { //Atualiza projeto var dbObj = projetosRepository.GetById(VM.Projeto.Id); (...) new ForecastProject(projectForecastRepository, projetoPPRInfoRepository).UpdateForecast(VM.Forecasts, VM.Projeto); (...) unitOfWork.Commit(); } object: \sgi\SGI2.Service\Services\Projects\ForecastProject.cs namespace SGI2.Service.Services.Projects { //Tenho de criar uma interface e remover a dependecia dos repositórios public class ForecastProject { private readonly IProjectForecastRepository projectForecastRepository; private readonly IProjetoPPRInfoRepository projetoPPRInfoRepository; private readonly IForecastDomain Iforecast = new ForecastDomain(); public ForecastProject(IProjectForecastRepository projectForecastRepository, IProjetoPPRInfoRepository projetoPPRInfoRepository) { this.projectForecastRepository = projectForecastRepository; this.projetoPPRInfoRepository = projetoPPRInfoRepository; } (...) public void UpdateForecast(List<ProjectForecastEditVM> forecasts, ProjetoVM Projeto) { // 1º Caso não exista linhas if (forecasts == null || forecasts.Count() == 0) { foreach (var item in Iforecast.InitialLinesForecast(Projeto)) { projectForecastRepository.Add(item); } } // 2º caso a data de fim do projeto aumente else if (Projeto.RealEndDate > forecasts.LastOrDefault().EndDate) { foreach (var item in Iforecast.ChangeRealEndDateForecast(Projeto,forecasts.LastOrDefault().EndDate)) { projectForecastRepository.Add(item); } } else { List<ProjectForecast> Forecasts = new List<ProjectForecast>(); foreach (var i in forecasts) { //Está assim pois a data fim pode mudar e deixar de ser o ultimo dia do mês DateTime EndDate = new DateTime(i.EndDate.Year, i.EndDate.Month, DateTime.DaysInMonth(i.EndDate.Year, i.EndDate.Month)); //Ultimo dia do mês do projeto DateTime LastDateofProject = new DateTime(Projeto.RealEndDate.Value.Year, Projeto.RealEndDate.Value.Month, DateTime.DaysInMonth(Projeto.RealEndDate.Value.Year, Projeto.RealEndDate.Value.Month)); if (EndDate > LastDateofProject && i.CanWrite == true) { projectForecastRepository.Delete(projectForecastRepository.GetById(i.Id)); } else { Forecasts.Add(UpdateForecastForecastFactory(Projeto, i)); } } foreach (var item in Forecasts) { projectForecastRepository.Update(item); ! The error is thrown here ! } } } } object: \SGI2.Data\Infrastructure\IRepository.cs using System; using System.Collections.Generic; using System.Linq.Expressions; namespace SGI2.Data.Infrastructure { public interface IRepository<T> where T : class { // Marks an entity as new void Add(T entity); // Marks an entity as modified void Update(T entity); // Marks an entity to be removed void Delete(T entity); void Delete(Expression<Func<T, bool>> where); // Get an entity by int id T GetById(int id); // Get an entity using delegate T Get(Expression<Func<T, bool>> where); // Gets all entities of type T IEnumerable<T> GetAll(); // Gets entities using delegate IEnumerable<T> GetMany(Expression<Func<T, bool>> where); } } object: \SGI2.Data\Infrastructure\RepositoryBase.cs public virtual void Update(T entity) { dbSet.Attach(entity); ! The error is thrown here ! dataContext.Entry(entity).State = EntityState.Modified; } What can I do to resolve? What i want is call twice :_service.UpdateProjeto Best regards Isabel Fonseca10KViews0likes3Comments.Net 4.8 not showing in "Windows Features" for Windows Server 2019
Hello, We have installed .Net 4.8 on a Windows Server 2019 OS, and it wont show under "Windows Feautures". What we see there is only .Net 3.5 and .Net 4.7. It´s crucial that we see .Net 4.8 in "Windows features" so we can turn on/off some features needed for us in order to run our programs that we use. Reading this thread with the same issue: https://techcommunity.microsoft.com/t5/windows-server-for-it-pro/server-2019-net-4-8-not-showing-in-features/m-p/3714980 One comment told OP that its included in Windows, but it wasnt included in our windows. And even if it was, we still need to see the .Net 4.8 so we can turn on and off some features. What can we do?8.5KViews0likes3CommentsThe SSL connection could not be established
We have developed an application using Microsoft.Net Core. The application has a function that generates tokens and executes an API call. Suddenly the application is throwing an error while generating the token. When we test the application, the same application is working on Windows applications but not on Windows servers. It would be helpful if anyone could guide us on how to resolve this issue Exception from server: System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: Authentication failed, see inner exception. ---> System.ComponentModel.Win32Exception (590615): The context has expired and can no longer be used. --- End of inner exception stack trace --- at System.Net.Security.SslStream.ForceAuthenticationAsync[TIOAdapter](TIOAdapter adapter, Boolean receiveFirst, Byte[] reAuthenticationData, Boolean isApm) at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) --- End of inner exception stack trace --- at System.Net.Http.ConnectHelper.EstablishSslConnectionAsync(SslClientAuthenticationOptions sslOptions, HttpRequestMessage request, Boolean async, Stream stream, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request) at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellation(CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken) at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken) at System.Net.Http.HttpMessageHandlerStage.Send(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.SocketsHttpHandler.Send(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpMessageInvoker.Send(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.Send(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at System.Net.HttpWebRequest.SendRequest(Boolean async) at System.Net.HttpWebRequest.GetResponse()8KViews1like6CommentsVB.NET. "The process cannot access the file because it is being used by another process"
I should add a list of files into a ZIP. Procedure code is like this Sub CreateZip Dim FileList As New ArrayList 'List of File Paths to be added to the ZIP For Each path in FileList Try AddFileToZip(ZipFilePath, path.ToString) Catch (ex as New Exception) .... End Try Next End Sub And this is AddFileToZip Public Sub AddFileToZip(ByVal zipFilename As String, ByVal fileToAdd As String) Using zip As Package = System.IO.Packaging.Package.Open(zipFilename, FileMode.OpenOrCreate) Dim destFilename As String = ".\" & Path.GetFileName(fileToAdd) Dim uri As Uri = PackUriHelper.CreatePartUri(New Uri(destFilename, UriKind.Relative)) If zip.PartExists(uri) Then zip.DeletePart(uri) End If Dim part As PackagePart = zip.CreatePart(uri, "", CompressionOption.Normal) Using fileStream As New FileStream(fileToAdd, FileMode.Open, FileAccess.Read) Using dest As Stream = part.GetStream() CopyStream(fileStream, dest) End Using End Using End Using End Sub At runtime, I get this error message The process cannot access the file [ZipFilePath] because it is being used by another process this error is raised randomly, maybe on adding small files into the Zip. If I place breakpoints and run procedure in debug mode, it works. It seems clear that procedure thread is not synchronized with IO, so that my procedure loop continues even if IO is still adding processed file into Zip (ie VB.NET is faster than IO). I also tried to place a Thread.Sleep(1000) before AddFileToZip, but this may be not enough to synchronize the two processes. Placing Thread.Sleep(2000) seems to make procedure work, but it may slow down dramaticly performances (I should pack more than 50 files into my Zip). So, how can I force my loop to "wait" until IO Process has released ZIP file?8KViews0likes4CommentsMy Program crashes suddenly every day with a Kernelbase Error
Hi, My program without any change started to crash. This has happened to 3 servers, and they all have the BitDefender antivirus. I have added the folder path of my execution in the exclusion list to all 3, and on the 2 servers the problem seems to be fixed. On the 3rd one, it keeps crashing. How can I fix the problem? The program has not changed the last 6 months and started happening on all 3 servers around the same time. The event viewer shows this: Faulting application name: DDispatcherService.exe, version: 2.4.3.26, time stamp: 0x61a60abd Faulting module name: KERNELBASE.dll, version: 10.0.17763.2300, time stamp: 0xd055b226 Exception code: 0xe0434352 Fault offset: 0x00123542 Faulting process id: 0x2f44 Faulting application start time: 0x01d8052c2443c06b Faulting application path: C:\Program Files (x86)\DD\DDispatcher.exe Faulting module path: C:\Windows\System32\KERNELBASE.dll Report Id: 5813572f-e03f-4026-a236-c5fd89647bfd Faulting package full name: Faulting package-relative application ID: And a Windows Error Reporting: Fault bucket 1426045923025303762, type 1 Event Name: APPCRASH Response: Not available Cab Id: 0 Problem signature: P1: DDispatcherService.exe P2: 2.4.3.26 P3: 61a60abd P4: KERNELBASE.dll P5: 10.0.17763.2300 P6: d055b226 P7: e0434352 P8: 00123542 P9: P10: The minidump is the below: Version=1 EventType=APPCRASH EventTime=132838809590781267 ReportType=2 Consent=1 UploadTime=132838809609219639 ReportStatus=268435456 ReportIdentifier=6c93b100-3250-47a7-a9b0-af8e678f908e IntegratorReportIdentifier=ff9bd1dc-9cce-414b-a4e5-06fab24be09f Wow64Host=34404 Wow64Guest=332 NsAppName=DDispatcher.exe OriginalFilename=ORCADispatcher.exe AppSessionGuid=00002268-0000-0036-81ca-01d04eefd701 TargetAppId=W:0000fd49ac2a2446d51c1618f26dc2aac6e000000904!00006ee9cc2a63e4cd5763015b7f4f2986426226556b!DDispatcher.exe TargetAppVer=2021//11//30:07:35:40!0!DDispatcher.exe BootId=4294967295 ServiceSplit=4294967294 TargetAsId=51125 IsFatal=1 EtwNonCollectReason=1 Response.BucketId=2f418cc290d9960ec45faf9f34c5cb50 Response.BucketTable=1 Response.LegacyBucketId=1468085101866109776 Response.type=4 Sig[0].Name=Application Name Sig[0].Value=DDispatcher.exe Sig[1].Name=Application Version Sig[1].Value=2.4.3.26 Sig[2].Name=Application Timestamp Sig[2].Value=61a5d44c Sig[3].Name=Fault Module Name Sig[3].Value=KERNELBASE.dll Sig[4].Name=Fault Module Version Sig[4].Value=10.0.17763.2300 Sig[5].Name=Fault Module Timestamp Sig[5].Value=d055b226 Sig[6].Name=Exception Code Sig[6].Value=e0434352 Sig[7].Name=Exception Offset Sig[7].Value=00123542 DynamicSig[1].Name=OS Version DynamicSig[1].Value=10.0.17763.2.0.0.272.7 DynamicSig[2].Name=Locale ID DynamicSig[2].Value=1032 DynamicSig[22].Name=Additional Information 1 DynamicSig[22].Value=4414 DynamicSig[23].Name=Additional Information 2 DynamicSig[23].Value=441449d45b16b50a448c25c3c19018ff DynamicSig[24].Name=Additional Information 3 DynamicSig[24].Value=f18c DynamicSig[25].Name=Additional Information 4 DynamicSig[25].Value=f18ce686755039c1959d24eafe818cbb UI[2]=C:\Program Files (x86)\DD\DDispatcher.exe UI[5]=Check online for a solution (recommended) UI[6]=Check for a solution later (recommended) UI[7]=Close UI[8]=DDispatcher Service stopped working and was closed UI[9]=A problem caused the application to stop working correctly. Windows will notify you if a solution is available. UI[10]=&Close LoadedModule[0]=C:\Program Files (x86)\DD\DDispatcher.exe LoadedModule[1]=C:\Windows\SYSTEM32\ntdll.dll LoadedModule[2]=C:\Windows\SYSTEM32\MSCOREE.DLL LoadedModule[3]=C:\Windows\System32\KERNEL32.dll LoadedModule[4]=C:\Windows\System32\KERNELBASE.dll LoadedModule[5]=C:\Program Files\Bitdefender\Endpoint Security\bdhkm\dlls_265668779268828305\bdhkm32.dll LoadedModule[6]=C:\Program Files\Bitdefender\Endpoint Security\atcuf\dlls_265668778449577156\atcuf32.dll LoadedModule[7]=C:\Windows\System32\ADVAPI32.dll LoadedModule[8]=C:\Windows\System32\msvcrt.dll LoadedModule[9]=C:\Windows\System32\sechost.dll LoadedModule[10]=C:\Windows\System32\RPCRT4.dll LoadedModule[11]=C:\Windows\System32\SspiCli.dll LoadedModule[12]=C:\Windows\System32\CRYPTBASE.dll LoadedModule[13]=C:\Windows\System32\bcryptPrimitives.dll LoadedModule[14]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscoreei.dll LoadedModule[15]=C:\Windows\System32\SHLWAPI.dll LoadedModule[16]=C:\Windows\System32\combase.dll LoadedModule[17]=C:\Windows\System32\ucrtbase.dll LoadedModule[18]=C:\Windows\System32\GDI32.dll LoadedModule[19]=C:\Windows\System32\gdi32full.dll LoadedModule[20]=C:\Windows\System32\msvcp_win.dll LoadedModule[21]=C:\Windows\System32\USER32.dll LoadedModule[22]=C:\Windows\System32\win32u.dll LoadedModule[23]=C:\Windows\System32\kernel.appcore.dll LoadedModule[24]=C:\Windows\SYSTEM32\VERSION.dll LoadedModule[25]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll LoadedModule[26]=C:\Windows\SYSTEM32\MSVCR120_CLR0400.dll LoadedModule[27]=C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\6adbe86137d46bdee6a2f3ea31580ae6\mscorlib.ni.dll LoadedModule[28]=C:\Windows\System32\ole32.dll LoadedModule[29]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\clrjit.dll LoadedModule[30]=C:\Windows\System32\OLEAUT32.dll LoadedModule[31]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System\a80c9fa6c622fdba92052bf8d2161593\System.ni.dll LoadedModule[32]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Serv759bfb78#\2f13c52680ff400d16e9d8271504a3c6\System.ServiceProcess.ni.dll LoadedModule[33]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\c91e39e547f0bdd60e1f1f9ea73d2795\System.Core.ni.dll LoadedModule[34]=C:\Windows\System32\shell32.dll LoadedModule[35]=C:\Windows\System32\cfgmgr32.dll LoadedModule[36]=C:\Windows\System32\shcore.dll LoadedModule[37]=C:\Windows\System32\windows.storage.dll LoadedModule[38]=C:\Windows\System32\profapi.dll LoadedModule[39]=C:\Windows\System32\powrprof.dll LoadedModule[40]=C:\Windows\System32\cryptsp.dll LoadedModule[41]=C:\Windows\system32\rsaenh.dll LoadedModule[42]=C:\Windows\System32\bcrypt.dll LoadedModule[43]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Management\d60651391c52d17dce617c927c6ed256\System.Management.ni.dll LoadedModule[44]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\wminet_utils.dll LoadedModule[45]=C:\Windows\System32\clbcatq.dll LoadedModule[46]=C:\Windows\system32\wbem\wmiutils.dll LoadedModule[47]=C:\Windows\SYSTEM32\wbemcomn.dll LoadedModule[48]=C:\Windows\System32\WS2_32.dll LoadedModule[49]=C:\Windows\system32\wbem\wbemprox.dll LoadedModule[50]=C:\Windows\system32\wbem\wbemsvc.dll LoadedModule[51]=C:\Windows\system32\wbem\fastprox.dll LoadedModule[52]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\79c0f7c9ebc80da92593c512fbf018b8\System.Configuration.ni.dll LoadedModule[53]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data\66245b2e46f6ceeacb81e3eff7b53945\System.Data.ni.dll LoadedModule[54]=C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll LoadedModule[55]=C:\Windows\System32\CRYPT32.dll LoadedModule[56]=C:\Windows\System32\MSASN1.dll LoadedModule[57]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Runteb92aa12#\4bffb90896e5b1220c8c02e53a45d256\System.Runtime.Serialization.ni.dll LoadedModule[58]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.ServiceModel\1f39fc08546d98e2ccad65bb9306294d\System.ServiceModel.ni.dll LoadedModule[59]=C:\Windows\assembly\NativeImages_v4.0.30319_32\SMDiagnostics\57cede0c42a0b86849e60806d42ac8b5\SMDiagnostics.ni.dll LoadedModule[60]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Servd1dec626#\f3d048b3c9c3bba36e65fa5020a48613\System.ServiceModel.Internals.ni.dll LoadedModule[61]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\d7c427fb2d7fedaca511f3f67445a463\System.Xml.ni.dll LoadedModule[62]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Web.Services\5270c6f8ea8d61c6f3044201cb02d9c1\System.Web.Services.ni.dll LoadedModule[63]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Net.Http\16b57d581d6092d7254542ffb88c315d\System.Net.Http.ni.dll LoadedModule[64]=C:\Windows\SYSTEM32\httpapi.dll LoadedModule[65]=C:\Windows\System32\psapi.dll LoadedModule[66]=C:\Windows\system32\mswsock.dll LoadedModule[67]=C:\Windows\SYSTEM32\DNSAPI.dll LoadedModule[68]=C:\Windows\System32\NSI.dll LoadedModule[69]=C:\Windows\SYSTEM32\IPHLPAPI.DLL LoadedModule[70]=C:\Windows\System32\rasadhlp.dll LoadedModule[71]=C:\Windows\System32\fwpuclnt.dll LoadedModule[72]=C:\Windows\SYSTEM32\urlmon.dll LoadedModule[73]=C:\Windows\SYSTEM32\iertutil.dll LoadedModule[74]=C:\Windows\SYSTEM32\srvcli.dll LoadedModule[75]=C:\Windows\SYSTEM32\netutils.dll LoadedModule[76]=C:\Windows\SYSTEM32\PROPSYS.dll LoadedModule[77]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Transactions\886904aeefc0872fa78de624ce064f2d\System.Transactions.ni.dll LoadedModule[78]=C:\Windows\Microsoft.Net\assembly\GAC_32\System.Transactions\v4.0_4.0.0.0__b77a5c561934e089\System.Transactions.dll LoadedModule[79]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Numerics\e2705db391fbe1128163d804900b21a6\System.Numerics.ni.dll LoadedModule[80]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data86569bbf#\82f6f9963ea7b9fdd97b7602d09610c1\System.Data.OracleClient.ni.dll LoadedModule[81]=C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data.OracleClient\v4.0_4.0.0.0__b77a5c561934e089\System.Data.OracleClient.dll LoadedModule[82]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml.Linq\8aaa0ec6395d167df3d8beebee4e6cf9\System.Xml.Linq.ni.dll LoadedModule[83]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Drawing\56e030a62f5af755f009d79856a2b35f\System.Drawing.ni.dll LoadedModule[84]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Ente96d83b35#\b77ea80554a3e4088dc78538ab247768\System.EnterpriseServices.ni.dll LoadedModule[85]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Ente96d83b35#\b77ea80554a3e4088dc78538ab247768\System.EnterpriseServices.Wrapper.dll LoadedModule[86]=C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.Wrapper.dll LoadedModule[87]=C:\Windows\system32\security.dll LoadedModule[88]=C:\Windows\SYSTEM32\SECUR32.DLL LoadedModule[89]=C:\Windows\System32\schannel.dll LoadedModule[90]=C:\Windows\SYSTEM32\mskeyprotect.dll LoadedModule[91]=C:\Windows\SYSTEM32\ncrypt.dll LoadedModule[92]=C:\Windows\SYSTEM32\NTASN1.dll LoadedModule[93]=C:\Windows\system32\ncryptsslp.dll LoadedModule[94]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Runt19c51595#\16790b161c602f0ae84e31090a4ec4cb\System.Runtime.Caching.ni.dll LoadedModule[95]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Comp46f2b404#\0aa4c3c814944ff754ff3f111a030e4f\System.ComponentModel.DataAnnotations.ni.dll LoadedModule[96]=C:\Windows\SYSTEM32\dhcpcsvc6.DLL LoadedModule[97]=C:\Windows\SYSTEM32\dhcpcsvc.DLL LoadedModule[98]=C:\Windows\SYSTEM32\WINNSI.DLL LoadedModule[99]=C:\Windows\SYSTEM32\rasapi32.dll LoadedModule[100]=C:\Windows\SYSTEM32\rasman.dll LoadedModule[101]=C:\Windows\SYSTEM32\rtutils.dll LoadedModule[102]=C:\Windows\SYSTEM32\winhttp.dll LoadedModule[103]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Windows.Forms\cd0b49d365f500c40b88ff483f76283c\System.Windows.Forms.ni.dll LoadedModule[104]=C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Data.Entity\b79d45f91ec5917e0f68d66496f46abf\System.Data.Entity.ni.dll LoadedModule[105]=C:\Windows\system32\napinsp.dll LoadedModule[106]=C:\Windows\System32\winrnr.dll LoadedModule[107]=C:\Windows\system32\NLAapi.dll LoadedModule[108]=C:\Windows\system32\wshbth.dll LoadedModule[109]=C:\Windows\Microsoft.NET\Framework\v4.0.30319\diasymreader.dll State[0].Key=Transport.DoneStage1 State[0].Value=1 OsInfo[0].Key=vermaj OsInfo[0].Value=10 OsInfo[1].Key=vermin OsInfo[1].Value=0 OsInfo[2].Key=verbld OsInfo[2].Value=17763 OsInfo[3].Key=ubr OsInfo[3].Value=200 OsInfo[4].Key=versp OsInfo[4].Value=0 OsInfo[5].Key=arch OsInfo[5].Value=9 OsInfo[6].Key=lcid OsInfo[6].Value=1032 OsInfo[7].Key=geoid OsInfo[7].Value=98 OsInfo[8].Key=sku OsInfo[8].Value=7 OsInfo[9].Key=domain OsInfo[9].Value=1 OsInfo[10].Key=prodsuite OsInfo[10].Value=272 OsInfo[11].Key=ntprodtype OsInfo[11].Value=3 OsInfo[12].Key=platid OsInfo[12].Value=10 OsInfo[13].Key=sr OsInfo[13].Value=0 OsInfo[14].Key=tmsi OsInfo[14].Value=1435801 OsInfo[15].Key=osinsty OsInfo[15].Value=1 OsInfo[16].Key=iever OsInfo[16].Value=11.1790.17763.0-11.0.1000 OsInfo[17].Key=portos OsInfo[17].Value=0 OsInfo[18].Key=ram OsInfo[18].Value=65536 OsInfo[19].Key=svolsz OsInfo[19].Value=139 OsInfo[20].Key=wimbt OsInfo[20].Value=0 OsInfo[21].Key=blddt OsInfo[21].Value=180914 OsInfo[22].Key=bldtm OsInfo[22].Value=1434 OsInfo[23].Key=bldbrch OsInfo[23].Value=rs5_release OsInfo[24].Key=bldchk OsInfo[24].Value=0 OsInfo[25].Key=wpvermaj OsInfo[25].Value=0 OsInfo[26].Key=wpvermin OsInfo[26].Value=0 OsInfo[27].Key=wpbuildmaj OsInfo[27].Value=0 OsInfo[28].Key=wpbuildmin OsInfo[28].Value=0 OsInfo[29].Key=osver OsInfo[29].Value=10.0.17763.2300.amd64fre.rs5_release.180914-1434 OsInfo[30].Key=buildflightid OsInfo[31].Key=edition OsInfo[31].Value=ServerStandard OsInfo[32].Key=ring OsInfo[33].Key=expid OsInfo[34].Key=containerid OsInfo[35].Key=containertype OsInfo[36].Key=edu OsInfo[36].Value=0 FriendlyEventName=Stopped working ConsentKey=APPCRASH AppName=DDispatcher Service AppPath=C:\Program Files (x86)\DD\DDispatcher.exe NsPartner=windows NsGroup=windows8 ApplicationIdentity=E24BD24E65C0C1FF823BD0C99AFA6432 MetadataHash=14917890613.6KViews0likes0CommentsSystem.Media Lavf58.29.100
System.Media.SoundPlayer(file Path) is getting an error when trying to play a Wav Audio file with Encoding Lavf58.29.100, but when i manage to convert that same audio file using FFMpeg to a newer version, Lavf59.33.100 with ADPCM, it worked on Sound Player of System Media. The same audio file (Lavf58.29.100) can be played through Windows media Player but not on this System.Media.SoundPlayer(file Path). Error "is not a valid wave file"3.6KViews0likes1CommentLoad report failed
Hi Guys, we have a .net application that use to work fine, but after our system admin processed some updates in the server now Crystal report aren't woking anymore with the following error: Source: CrystalDecisions.CrystalReports.Engine ...... Message: Load report failed. any help pls? Thanks3.3KViews0likes2Comments