出力ウィンドウの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
私はそれがここで最初の行で
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
を投げ、私のMessageControllerで何か
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;
}
}
一つweired事は、私の場合ということで、スナップショットですプロジェクトはC:\ Users \\ chatbot \ Mybotから実行します。 例外設定ウィンドウにブレーク例外設定を入れても、これらの例外はスローされません。 しかし、プロジェクトをc:\ Sandy \ MyStuff \ ChatbOt \ MyBotに移動すると、例外設定ウィンドウにブレーク例外設定を入れているので、これらの例外がすべてスローされ始めます。
私は真剣に何が問題なのか理解できません。
私はそれがあなたの参考文献に言及していると思うかもしれません。それらのdllに対して "copy local"がtrueに設定されていることを確認し、新しいフォルダに移動した後で一度再構築してください。 –
MSDNを試してみてください。ちょうどGoogleの例外を入力してリンクをたどります。そこにはすべてのエラーが記述されています。 'FileNotFound' - いくつかのファイルが見つからないためです。 'ArgumentNull' - その行にはいくつかの引数がヌルであるため(App.Configにはコードで使用するすべての設定が含まれていることを確認します)。 'BadImageFormat' - あなたが参照できるdll/exeファイルの1つが、他のフレームワークバージョンとコンパイルされていて、プロジェクトで最新のバージョンを使用していることを意味します。 – Sergio
「別のフォルダに移動」についてプロジェクト参照のすべてのパスを確認してください。特に静的パスの場合、このパスに存在することを確認してください。 – Sergio