这是我的第三次IdentityServer安装,我从未遇到过这种情况。该应用程序在我们的开发环境中运行良好,该环境是Server 2012 R2并安装了.NET 4.6。
PROD服务器是Server 2012 R2,只安装了.NET 4.5.2。安装4.6不是一个选项,希望它是。服务器很好地被锁定了。
这里是堆栈跟踪,我试过挖掘代码,但我在Core \ Configuration \ Hosting \ WebApiConfig.cs:38中遇到了死胡同。我强迫目标框架到4.5.1只是为了看它是否有所作为。
我通过转到.well-known / openid-configuration来测试它。
[MissingMethodException:找不到方法:' System.String System.String.Format(System.IFormatProvider,System.String, System.Object的)&#39 ;.]
System.Net.Http.Headers.MediaTypeHeaderValue.CheckMediaTypeFormat(字符串 mediaType,String parameterName)+0
System.Net.Http.Headers.MediaTypeHeaderValue..ctor(String mediaType) +33 System.Net.Http.Formatting.MediaTypeConstants..cctor()+45[TypeInitializationException:类型初始值设定项 ' System.Net.Http.Formatting.MediaTypeConstants'抛出异常。]
System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor()+99
System.Net.Http.Formatting.MediaTypeFormatterCollection.CreateDefaultFormatters() +49 System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection routes)+255
IdentityServer3.Core.Configuration.Hosting.WebApiConfig.Configure(IdentityServerOptions 选项,ILifetimeScope容器) 核心\配置\主机\ WebApiConfig.cs:38 Owin.UseIdentityServerExtension.UseIdentityServer(IAppBuilder应用程序, Core \ Configuration \ AppBuilderExtensions \ UseIdentityServerExtension.cs中的IdentityServerOptions选项):109 Owin.MapExtensions.Map(IAppBuilder应用程序,PathString pathMatch,Action 1 配置)+240 Owin.MapExtensions.Map(IAppBuilder app,String pathMatch,Action`1配置)+181
WEC.WebApp.IdSrv.Startup.Configuration(IAppBuilder app)中 C:\项目\ WEC.WebApp.Authentication \ DEV \ WEC.IdentityServer \ WEC.WebApp.IdSrv \ Startup.cs:44[TargetInvocationException:目标抛出了异常 一个调用。] System.RuntimeMethodHandle.InvokeMethod(Object target,Object []参数,签名sig,布尔构造函数)+0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object []参数,Object []参数)+76
System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object []参数,CultureInfo文化) +211 System.Reflection.MethodBase.Invoke(Object obj,Object [] parameters)+35
Owin.Loader<> c__DisplayClass1.b__0(IAppBuilder 建设者)+341
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action 1 启动)+1043
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +119 System.Threading.LazyInitializer.EnsureInitializedCore(T& target,Boolean& initialized,Object& syncLock,Func`1 valueFactory) +241 Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication) 上下文)+129
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr的 appContext,HttpContext上下文,MethodInfo []处理程序)+571
System.Web.HttpApplication.InitSpecial(HttpApplicationState状态, MethodInfo [] handlers,IntPtr appContext,HttpContext context)+322
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr的 appContext,HttpContext context)+402
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr的 appContext)+452[HttpException(0x80004005):目标抛出了异常 一个调用。] System.Web.HttpRuntime.FirstRequestInit(HttpContext context)+646
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest) wr,HttpContext context)+778