2017-06-16 20 views
1

私のアプリケーションのサービスバージョンを "4.5.12"にアップグレードすると、以下のようにエラーが発生します。'プロパティを見つけることができませんでした'というエラーが発生しました

すべての私のアプリケーション構成の第一は、このbasiclyのようなものです:

[Route("https://stackoverflow.com/users/{Id}")] 
public class User : IReturn<UserResponse> 
{ 
    public int Id { get; set; } 
    public string Name { get; set; } 
} 

public class UserResponse 
{ 
    public int Id { get; set; } 
    public string Name { get; set; } 
    public string Surname { get; set; } 

} 

public class MyServices : Service 
{ 
    public object Any(User request) 
    { 
     return new UserResponse { Id = request.Id, Name = request.Name, Surname = "Unknown"}; 
    } 
} 

私はこのようなサービスを呼び出す場合: [http://localhost:24365/users/1?format=json][1]

私はエラーを取得しています:

{ 
"ResponseStatus": { 
    "ErrorCode": "ArgumentException", 
    "Message": "Could not find property Id on User", 
    "StackTrace": " konum: ServiceStack.Host.RestPath.CreateRequest(String pathInfo, Dictionary`2 queryStringAndFormData, Object fromInstance)\r\n konum: ServiceStack.Host.RestHandler.CreateRequest(IRequest httpReq, IRestPath restPath, Dictionary`2 requestParams, Object requestDto)\r\n konum: ServiceStack.Host.RestHandler.CreateRequest(IRequest httpReq, IRestPath restPath, Dictionary`2 requestParams)\r\n konum: ServiceStack.Host.RestHandler.CreateRequest(IRequest httpReq, IRestPath restPath)\r\n konum: ServiceStack.Host.RestHandler.ProcessRequestAsync(IRequest httpReq, IResponse httpRes, String operationName)" 
} 

}

しかし、私は "Id" "User"モデルのプロパティ。誰かがこのような問題を抱えていますか?

答えて

2

github(line:425)でこのエラーの理由からgithubを確認しました。

私は考えています:417はこのエラーを引き起こします。

if (!this.propertyNamesMap.TryGetValue(variableName.ToLower(), out propertyNameOnRequest)) 

"I"と "i"は私たちのPC言語では同じではないためです。 (文化:TR-TR)の問題を修正するために

私はこのようなapphost.csファイルにいくつかのコードを追加する必要があります。

public class AppHost : AppHostBase 
{ 
    public override RouteAttribute[] GetRouteAttributes(Type requestType) 
    { 
     var routes = base.GetRouteAttributes(requestType); 
     routes.Each(x => x.Path = x.Path.ToLower(CultureInfo.GetCultureInfo("en-US"))); 
     return routes; 
    } 
} 
関連する問題