2017-02-02 1 views
0

출력 창에서 chatbot 응용 프로그램을 시작할 때 처리되지 않은 예외 아래에 있습니다.내 C# 프로젝트 시작시 처리되지 않은 예외가 발생했습니다.

Exception thrown: 'System.UnauthorizedAccessException' in mscorlib.dll 
Exception thrown: 'System.Globalization.CultureNotFoundException' in mscorlib.dll 
Exception thrown: 'System.Security.SecurityException' in mscorlib.dll 
Exception thrown: 'System.BadImageFormatException' in mscorlib.dll 
Exception thrown: 'System.ArgumentNullException' in mscorlib.dll 
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll 
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll 

나는 exception2

한 weired 것입니다,

public class MessagesController : ApiController 
    { 
     private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); 
     private static DocumentClient client; 
     // Retrieve the desired database id (name) from the configuration file 
     private static readonly string databaseId = ConfigurationManager.AppSettings["DatabaseId"]; 
     // Retrieve the desired collection id (name) from the configuration file 
     private static readonly string collectionId = ConfigurationManager.AppSettings["CollectionId"]; 
     // Retrieve the DocumentDB URI from the configuration file 
     private static readonly string endpointUrl = ConfigurationManager.AppSettings["EndpointUri"]; 
     // Retrieve the DocumentDB Authorization Key from the configuration file 
     private static readonly string authorizationKey = ConfigurationManager.AppSettings["PrimaryKey"]; 

     /// <summary> 
     /// POST: api/Messages 
     /// Receive a message from a user and reply to it 
     /// </summary> 
     public async Task<HttpResponseMessage> Post([FromBody]Activity activity) 
     { 
      Trace.TraceInformation($"Type={activity.Type} Text={activity.Text}"); 

      //disable the Application Insights and DocumentDb logging in local enviornment 
      #if (LOCAL)    
       Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration.Active.DisableTelemetry = true; 
      #endif 
      #if (!LOCAL) 
       if (!String.IsNullOrEmpty(endpointUrl) && !String.IsNullOrEmpty(authorizationKey)) 
       { 
        using (client = new DocumentClient(new Uri(endpointUrl), authorizationKey)) 
        { 
         await CaptureConversationData(activity); 
        } 
       } 
      #endif 

      if (activity.Type == ActivityTypes.Message) 
      { 
       //await Microsoft.Bot.Builder.Dialogs.Conversation.SendAsync(activity,() => new ContactOneDialog()); 

       //Implementation of typing indication 
       //ConnectorClient connector = new ConnectorClient(new System.Uri(activity.ServiceUrl)); 
       //Activity isTypingReply = activity.CreateReply("Shuttlebot is typing..."); 
       //isTypingReply.Type = ActivityTypes.Typing; 
       //await connector.Conversations.ReplyToActivityAsync(isTypingReply); 

       logger.Debug("The User's local timeStamp is: " + activity.LocalTimestamp + "and service timeStamp is: " + activity.Timestamp); 
       await Conversation.SendAsync(activity,() => 
       new ExceptionHandlerDialog<object>(new ShuttleBusDialog(), displayException: true)); 
      } 
      else 
      { 
       HandleSystemMessage(activity); 
      } 
      var response = Request.CreateResponse(System.Net.HttpStatusCode.OK); 
      return response; 
     } 
} 

그것은 스냅 샷 Exceptione은 첫 번째 줄 여기

private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); 

던져 내 MessageController에 뭔가가있는 경우 그 내 C : \ Users \\ chatbot \ Mybot에서 실행되는 프로젝트입니다. 그런 다음이 예외는 예외 설정 창에서 중단 예외 설정을 적용한 경우에도 발생하지 않습니다. 하지만 프로젝트를 c : \ Sandy \ MyStuff \ ChatbOt \ MyBot으로 이동하면 예외 설정 창에서 예외 예외 설정을 했으므로이 모든 예외가 발생하기 시작합니다.

나는 무엇이 문제인지 심각하게 이해할 수 없다.

+0

내가 언급 한 dll에 대한 언급 때문일 수 있습니다. 해당 dll에 대해 "copy local"이 true로 설정되어 있는지 확인하고 새 폴더로 이동 한 후 해당 DLL을 한 번 재 빌드하십시오. –

+0

MSDN을 사용해보십시오. Google에 예외를 입력하고 링크를 따라 가십시오. 모든 오류는 여기에 설명되어 있습니다. 'FileNotFound' - 일부 파일을 찾을 수 없기 때문에. 'ArgumentNull' - 그 줄에서 몇몇 인수가 널이기 때문에 (App.Config가 당신이 코드에서 사용하는 모든 설정을 포함하는지 확인하십시오). 'BadImageFormat' - 당신이 참조 할 수있는 dll/exe 파일 중 하나가 다른 프레임 워크 버전으로 컴파일되었고 프로젝트에서 최신 버전을 사용한다는 것을 의미합니다. – Sergio

+0

그리고 "다른 폴더로 옮겼습니다". 프로젝트 참조의 모든 경로를 확인하십시오. 특히 정적 경로의 경우이 경로에 존재하는지 확인하십시오. – Sergio

답변

0

Visual Studio를 관리자로 실행하거나 관리자 권한으로 응용 프로그램을 실행하고 프로젝트가 사용하는 모든 DLL이 새 경로에 있는지 확인하십시오.

+0

관리자로서 Visual Studio를 실행하면 문제가 없지만 이전에 시도했지만 실제 문제를 알고 싶었습니다. – Sandy

+0

아마도 "C : \"경로가 "C : \ Users" –

관련 문제