System.ArgumentNullException'在mscorlib.dll中发生,但未在用户代码中处理

本文关键字:用户 处理 代码 ArgumentNullException mscorlib System dll | 更新日期: 2023-09-27 18:13:06

当我试图运行我的应用程序时,我得到这个异常

An exception of type 'System.ArgumentNullException' occurred in mscorlib.dll but was not handled in user code

Global.asaxcs文件中GlobalConfiguration.Configure(WebApiConfig.Register);

代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Routing;
namespace Bot_Application2_test
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            GlobalConfiguration.Configure(WebApiConfig.Register);
        }
    }
}

如何解决这个问题?

System.ArgumentNullException'在mscorlib.dll中发生,但未在用户代码中处理

我也面临同样的问题。在解决方案资源管理器-> Web中。配置。确保AppID &AppSecret不为空。{

 <appSettings>
    <!-- update these with your appid and one of your appsecret keys-->
    <add key="AppId" value="YourAppId" />
    <add key="AppSecret" value="YourAppSecret" />
  </appSettings> 

}

希望它能帮助你!