2014-11-08 19 views
0

我最近買了一臺新計算機,並將此項目上載到FTP服務器,然後將其下載到我的新計算機,但現在它導致此錯誤:未處理的異常:System.InvalidProgramException:公共語言運行時檢測到一個無效的程序

Unhandled Exception: System.InvalidProgramException: Common Language Runtime det 
ected an invalid program. 
    at Nancy.Conventions.NancyConventions.<Validate>b__1(Tuple'2 result) 
    at System.Linq.Enumerable.WhereEnumerableIterator'1.MoveNext() 
    at Nancy.Conventions.NancyConventions.Validate() 
    at Nancy.Bootstrapper.NancyBootstrapperBase'1.Initialise() 
    at Nancy.Hosting.Self.NancyHost..ctor(INancyBootstrapper bootstrapper, HostCo 
nfiguration configuration, Uri[] baseUris) 
    at Nancy.Hosting.Self.NancyHost..ctor(Uri baseUri, INancyBootstrapper bootstr 
apper, HostConfiguration configuration) 
    at PokerServer.Program.startServer() in f:\Projects\Visual Studio\PokerServer 
\PokerServer\Program.cs:line 93 
    at PokerServer.Program.Main() in f:\Projects\Visual Studio\PokerServer\PokerS 
erver\Program.cs:line 23 

它在舊電腦上運行良好。

我更新了.NET(以及在另一個線程中提到的Windows Update下的所有其他更新)。

我已經嘗試過無效和主動的「代碼優化」,沒有任何問題。

該目錄與以前不一樣,不確定是否會導致此問題?

驗證我的代碼peverify,如果我理解正確的是一切看起來不錯:

F:\Projects\Visual Studio\PokerServer\PokerServer\bin\Debug>peverify PokerServer 
.exe /md /il 

Microsoft (R) .NET Framework PE Verifier. Version 4.0.30319.33440 
Copyright (c) Microsoft Corporation. All rights reserved. 

All Classes and Methods in PokerServer.exe Verified. 

任何幫助,不勝感激!

回答

1

你真的在新計算機上編譯項目還是隻運行應用程序?

如果你只是在運行它,你是否確認應用程序部件或程序集在兩臺計算機上實際上是相同的?我建議你首先排除這個選項,在數據傳輸過程中發生了一些事情。

如果你正在編譯它,你在編譯什麼?視覺工作室?哪個版本?

在任何情況下,錯誤與文件目錄無關,應用程序位於。According to MSDN,應僅在編譯的應用程序無效(即編譯器存在錯誤的情況下)時拋出異常。你可以找到更多信息in this knowledge base article。按照文章的建議,嘗試運行PEVerify工具並在調試配置中重新構建應用程序。

+0

VS 12.0.30723.00。我從Nuget Manager中刪除並重新安裝了Nancy,現在它可以工作。 – Jefecito 2014-11-08 21:33:01

0

我刪除了舊的南希依賴並從Nuget再次安裝它,現在它的工作。

相關問題