找不到方法X509Chain.Dispose()

问题描述 投票:0回答:1

我的应用程序在本地环境中工作正常,但在生产服务器上不起作用。我得到了Exception“Method not found:'Void System.Security.Cryptography.X509Certificates.X509Chain.Dispose()'。”运行此代码时:

using (var responseMessage = await _httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, context.RequestAborted))
{
    context.Response.StatusCode = (int)responseMessage.StatusCode;
    var response = await responseMessage.Content.ReadAsStringAsync();
    context.Response.Headers.Remove("transfer-encoding");
    await responseMessage.Content.CopyToAsync(context.Response.Body);
}

这是我的日志文件:

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
  Request starting HTTP/1.1 GET http://myserver.com:8080/anything 
fail: Microsoft.AspNetCore.Server.Kestrel[13]
  Connection id "0HLCB1RVBIPJL": An unhandled exception was thrown by the application.
System.MissingMethodException: Method not found: 'Void System.Security.Cryptography.X509Certificates.X509Chain.Dispose()'.
at XControl.HttpRequestHandlerMiddleware.<ProcessRequestAsync>d__5.MoveNext() in C:\WorkingFolder\HttpRequestHandlerMiddleware.cs:line 168
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at XControl.HttpRequestHandlerMiddleware.<Invoke>d__4.MoveNext() in C:\WorkingFolder\HttpRequestHandlerMiddleware.cs:line 36
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at XControl.XControlMiddleware.<Invoke>d__2.MoveNext() in C:\WorkingFolder\Middleware.cs:line 22
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.<Invoke>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext()
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
  Request finished in 2256.0938ms 500 

这是我的project.json文件:

{
  "dependencies": {
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "EntityFramework": "6.1.3",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "net461": {
      "dependencies": {
        "Data": {
          "target": "project"
        }

      },
      "frameworkAssemblies": {
        "System.Configuration": "4.0.0.0"
      }
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "appsettings.json",
      "appsettings.Staging.json",
      "appsettings.Production.json",
      "web.config"
    ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

我的应用程序我使用.NET Framework版本在IIS 8中运行:无托管代码。

任何想法可能是什么问题?

c# .net asp.net-core .net-core iis-8
1个回答
0
投票

解决方案是让Windows更新完成它并更新clr版本。

© www.soinside.com 2019 - 2024. All rights reserved.