找不到方法:'System.String System.String.Format(System.IFormatProvider,System.String,System.Object) [英] Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)

查看:1201
本文介绍了找不到方法:'System.String System.String.Format(System.IFormatProvider,System.String,System.Object)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有帮助页面的Web API 2项目,该项目在本地运行良好,但是当我将其推送到Azure时抛出此错误:

I have a Web API 2 project with help pages that runs fine locally but throws this error when I push it to Azure:

未找到方法:'System.String System.String.Format (System.IFormatProvider,System.String,System.Object)

Method not found: 'System.String System.String.Format (System.IFormatProvider, System.String, System.Object)

我暂时关闭了自定义错误,因此可以在此处

I temporarily turned custom errors off so full stack trace can be seen here

该错误源于此行代码:

string selectExpression = String.Format(CultureInfo.InvariantCulture,MethodExpression,GetMemberName(reflectedActionDescriptor.MethodInfo));

string selectExpression = String.Format(CultureInfo.InvariantCulture, MethodExpression, GetMemberName(reflectedActionDescriptor.MethodInfo));

请参见第96行此处

完整的源代码可在 GitHub

我什至不知道该去哪里.

I'm not even sure where to go with this one.

推荐答案

根据

According to its MSDN page, the overload you're using is only supported on .NET 4.6.

将主机配置为运行.NET 4.6或将项目的目标框架更改为4.5并重新编译.

Either configure the host to run .NET 4.6 or change the target framework of the project to 4.5 and recompile.

在4.5中,有一个 params object[]重载,然后选择它,而无需更改您的代码.

In 4.5 there's a params object[] overload which will then be chosen, without having to alter your code.

这篇关于找不到方法:'System.String System.String.Format(System.IFormatProvider,System.String,System.Object)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆