I have two servers but running generally the same setups - IIS, SQL Server, etc. One gives me this error, the other doesn't. I publish the same code from Visual Studio to both.
They are both running .NET CLR Version v4.0.30319
, which I believe is 4.5
.
Some answers say you have to target another version, If I change that in visual studio, everything breaks, so it is not that. Also, the same code runs on the others server.
Other answers say that some old DLL's could be the reason. I didn't deploy to the working server, so maybe some newer DLLs were copied? But how could I know?
Also, the error doesn't seem to be in my code, rather in the framework and Umbraco, so I don't think I should be going in and updating string functions or something like that:
[MissingMethodException: Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)'.]
System.Net.Http.Headers.MediaTypeHeaderValue.CheckMediaTypeFormat(String mediaType, String parameterName) +0
System.Net.Http.Headers.MediaTypeHeaderValue..ctor(String mediaType) +33
System.Net.Http.Formatting.MediaTypeConstants..cctor() +45
[TypeInitializationException: The type initializer for 'System.Net.Http.Formatting.MediaTypeConstants' threw an exception.]
System.Net.Http.Formatting.JsonMediaTypeFormatter..ctor() +99
System.Net.Http.Formatting.MediaTypeFormatterCollection.CreateDefaultFormatters() +49
System.Web.Http.HttpConfiguration..ctor(HttpRouteCollection routes) +255
System.Web.Http.GlobalConfiguration.<CreateConfiguration>b__0() +78
System.Lazy`1.CreateValue() +14308960
System.Lazy`1.LazyInitValue() +524
Umbraco.Web.WebBootManager.InitializeResolvers() +1530
Umbraco.Core.CoreBootManager.Initialize() +814
Umbraco.Web.WebBootManager.Initialize() +19
Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +244
[HttpException (0x80004005): The type initializer for 'System.Net.Http.Formatting.MediaTypeConstants' threw an exception.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +588
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +181
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, 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): The type initializer for 'System.Net.Http.Formatting.MediaTypeConstants' threw an exception.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +646
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +778
Generally, there isn't much info on Google, so not sure what could be done. Any insights are welcome!
If you check out documentation, that overload seem to be available only on .NET 4.6. It is possible that servers has different .NET Framework versions.
Closest overload on .NET 4.5:
Format(IFormatProvider, String, Object[])
On .NET 4.6 there is exactly same overload:
Format(IFormatProvider, String, Object)
Ensure that both servers has .NET 4.6 installed properly.
User contributions licensed under CC BY-SA 3.0