2016-10-13 2 views
0

Quand je suis en train d'exécuter ma demande que je reçois cette exceptionUne exception de type « System.ArgumentNullException » est produite dans mscorlib.dll mais n'a pas été traitée dans le code utilisateur

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

Dans le fichier Global.asaxcs en ligne GlobalConfiguration.Configure(WebApiConfig.Register);

Voici le code

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); 
     } 
    } 
} 

Comment résoudre ce problème?

+0

Ajout de la vérification de null avant cette ligne –

+0

Possible copie de [Qu'est-ce qu'une exception NullReferenceException, et comment puis-je la réparer?] (Http://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and -Comment je le répare) – Izzy

Répondre

1

J'ai fait face au même problème. Dans l'Explorateur de solutions -> Web.config. Assurez-vous que AppID & AppSecret n'est pas null. {

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

}

espérons qu'il vous aidera!