1

我有一个与运行 MongoDB 的远程服务器通信的 ASP.NET MVC Web 角色。连接字符串中包含凭据。当我在 localhost 上运行 MVC Web 角色时,它工作正常。但是,当我将 MVC Web 角色发布到 Azure 并运行它时,我得到以下错误/堆栈跟踪:

Invalid URI: There is an invalid sequence in the string.

Description: An unhandled exception occurred during the execution of the 
current web request. Please review the stack trace for more information 
about the error and where it originated in the code. 

Exception Details: System.UriFormatException: 
    Invalid URI: There is an invalid sequence in the string.

Source Error: 

An unhandled exception was generated during the execution of the current web request.
Information regarding the origin and location of the exception can be identified using
the exception stack trace below.

堆栈跟踪:

[UriFormatException: Invalid URI: There is an invalid sequence in the string.]
   System.Uri.UnescapeString(Char* pStr, Int32 start, Int32 end, Char[] dest, Int32&     destPosition, Char rsvd1, Char rsvd2, Char rsvd3, UnescapeMode unescapeMode, UriParser syntax, Boolean isQuery, Boolean readOnlyConfig) +618
   System.Uri.UnescapeDataString(String stringToUnescape) +280
   MongoDB.Driver.MongoUrlBuilder.Parse(String url) +237
   MongoDB.Driver.MongoUrl..ctor(String url) +47
   MongoDB.Driver.MongoUrl.Create(String url) +121
   MongoDB.Driver.MongoServer.Create(String connectionString) +54
   MongoDatabaseWrapper.get_Database() +30

如果代码在我的本地 PC 和 Azure 上运行,为什么 UnescapeString() 方法或此调用堆栈的行为会有所不同?

4

0 回答 0