首页 / C# / c#-找不到方法:“ System.String System.String.Format(System.IFormatProvider,System.String,System.Object)”
c#-找不到方法:“ System.String System.String.Format(System.IFormatProvider,System.String,System.Object)”
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了c#-找不到方法:“ System.String System.String.Format(System.IFormatProvider,System.String,System.Object)”,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2987字,纯文字阅读大概需要5分钟。
内容图文
我有两台服务器,但运行的设置大致相同,分别是IIS,SQL Server等.其中一个给我这个错误,而另一个却没有.我将相同的代码从Visual Studio发布到两者.
它们都运行.NET CLR版本v4.0.30319,我相信是4.5.
Some answers说您必须定位另一个版本,如果我在Visual Studio中更改它,一切都会中断,所以不是那样.同样,相同的代码在其他服务器上运行.
Other answers说某些旧的DLL可能是原因.我没有部署到工作服务器上,所以也许复制了一些较新的DLL?但是我怎么知道?
另外,错误似乎不在我的代码中,而是在框架和Umbraco中,所以我认为我不应该进入并更新字符串函数或类似的东西:
[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
通常,Google上没有太多信息,因此不确定该怎么做.欢迎有任何见识!
解决方法:
如果您检出documentation,则该过载似乎仅在.NET 4.6上可用.服务器可能具有不同的.NET Framework版本.
.NET 4.5上最接近的重载:
Format(IFormatProvider, String, Object[])
在.NET 4.6中,存在完全相同的重载:
Format(IFormatProvider, String, Object)
确保两台服务器均已正确安装.NET 4.6.
内容总结
以上是互联网集市为您收集整理的c#-找不到方法:“ System.String System.String.Format(System.IFormatProvider,System.String,System.Object)”全部内容,希望文章能够帮你解决c#-找不到方法:“ System.String System.String.Format(System.IFormatProvider,System.String,System.Object)”所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。