sách gpt4 ai đã đi

Không tìm thấy phương pháp: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)'

In lại 作者:行者123 更新时间:2023-11-30 15:51:53 47 4
mua khóa gpt4 Nike

我有两台服务器,但通常运行相同的设置 - IIS、SQL Server 等。一台给我这个错误,另一台没有。我从 Visual Studio 向两者发布相同的代码。

它们都在运行 .NET CLR Version 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.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 上没有太多信息,所以不确定可以做什么。欢迎任何见解!

1 Câu trả lời

如果你 checkout tài liệu ,该重载似乎仅适用于 .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)' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55766829/

47 4 0
Bài viết được đề xuất: javascript - 如何在选定的特定输入框上触发其他输入框
Bài viết được đề xuất: javascript - 轻松替换值中多行的字符串
Bài viết được đề xuất: javascript - React-Redux——从列表中选择项目
Bài viết được đề xuất: c# - 使用 Moq 模拟 IList.Add
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com