You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.
I created an empty aspnet5-mvc web application. It's a default app based on "WebApi" template with beta4 packages (dnx-beta4, "Microsoft.AspNet.Mvc": "6.0.0-beta4", "Microsoft.AspNet.Server.IIS": "1.0.0-beta4", "Microsoft.AspNet.Server.WebListener": "1.0.0-beta4").
Then I registered a service
public interface IQueryService
{
Uri GetQueryString(HttpContext ctx);
}
public class QueryService : IQueryService
{
public Uri GetQueryString(HttpContext ctx)
{
return new Uri(ctx.Request.QueryString.ToUriComponent());
}
}
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IQueryService, QueryService>();
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseMvc();
}
}
And added this service as dependency into a Controller:
public class ValuesController : Controller
{
[Activate]
public IQueryService QueryService { get; set; }
}
On accessing the controller I'm getting such an error:
System.InvalidOperationException
The property 'QueryService' on controller 'WebApplication5.Controllers.ValuesController' cannot be activated.
If I add a constructor with the dependency (ValuesController(IQueryService queryService)) then controller is activated.
What is wrong with ActivateAttribute?
The text was updated successfully, but these errors were encountered:
I created an empty aspnet5-mvc web application. It's a default app based on "WebApi" template with beta4 packages (dnx-beta4, "Microsoft.AspNet.Mvc": "6.0.0-beta4", "Microsoft.AspNet.Server.IIS": "1.0.0-beta4", "Microsoft.AspNet.Server.WebListener": "1.0.0-beta4").
Then I registered a service
And added this service as dependency into a Controller:
On accessing the controller I'm getting such an error:
System.InvalidOperationException
The property 'QueryService' on controller 'WebApplication5.Controllers.ValuesController' cannot be activated.
If I add a constructor with the dependency (
ValuesController(IQueryService queryService)
) then controller is activated.What is wrong with ActivateAttribute?
The text was updated successfully, but these errors were encountered: