Microsoft.AspNetCore.OData.vNextパッケージを使用しているASPNetコアWeb APIアプリケーションがあります。クエリ文字列を使用してOData機能を使用しようとすると、MissingManifestResourceExceptionが返されます。ここでは、コードの問題である:ODataクエリ文字列を使用するとMissingManifestResourceExceptionがスローされる
[EnableQuery]
[HttpGet()]
public class LocationsController : Controller
{
public IActionResult GetLocations()
{
IQueryable<Location> locationEntities = _locationInfoRepo.GetLocations();
if (locationEntities == null)
{
return NotFound();
}
var results = Mapper.Map<IEnumerable<LocationDTO>>(locationEntities);
return Ok(results);
}
}
注:私はすでにIActionResultからのIQueryable <>に無駄にする方法でタイプを変更しようとしました。私はAutomapper Mapメソッドをコメントアウトして、そこに問題がないことを確認しました。
ここではデータを返すために、EFを利用している方法です:?http://localhost/api/locations $フィルタ=名%20eq%20'Bob '
' 名前:
public IQueryable<Location> GetLocations()
{
return _context.Locations;
}
ここでは、クエリ文字列と一緒にURLがあります'はモデルで指定された文字列フィールドであり、データベースの列です。
スタックトレース:
System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Microsoft.AspNetCore.OData.SRResources.resources" was correctly embedded or linked into assembly "Microsoft.AspNetCore.OData.vNext" at compile time, or that all the satellite assemblies required are loadable and fully signed.
at System.Resources.ManifestBasedResourceGroveler.HandleResourceStreamMissing(String fileName)
at System.Resources.ManifestBasedResourceGroveler.GrovelForResourceSet(CultureInfo culture, Dictionary`2 localResourceSets, Boolean tryParents, Boolean createIfNotExists, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo requestedCulture, Boolean createIfNotExists, Boolean tryParents, StackCrawlMark& stackMark)
at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)
at System.Resources.ResourceManager.GetString(String name, CultureInfo culture)
at Microsoft.AspNetCore.OData.SRResources.GetString(String name, String[] formatterNames)
at Microsoft.AspNetCore.OData.SRResources.get_ClrTypeNotInModel()
at Microsoft.AspNetCore.OData.ODataQueryContext..ctor(IEdmModel model, Type elementClrType, ODataPath path)
at Microsoft.AspNetCore.OData.EnableQueryAttribute.OnActionExecuted(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Filters.ActionFilterAttribute.<OnActionExecutionAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextExceptionFilterAsync>d__24.MoveNext()
誰かが正しい方向に私を指すことができますか?
WebApi GitHubプロジェクトでODataチームと開いた問題を相互参照するには、その問題へのリンクがあります:https://github.com/OData/WebApi/issues/955 –