Hey, this is an English text. I want you to translate it into the Tunisian dialect.…
- User
Hey, this is an English text. I want you to translate it into the Tunisian dialect. Please follow these steps:
- Translate step by step and highlight differences between Tunisian dialect and Modern Standard Arabic.
- Highlight sections you are confident translating into the Tunisian dialect. Translate this text into the Tunisian dialect, focusing on capturing the essence of the language nuances:
Q: Why is TestServer not able to find controllers when controller is in separate assembly for asp.net core app? For some reason, when ASP.NET core controllers are created in separate assembly, the TestServer is not able to find controller actions when the client makes a request.(results in 404 response) Why is this? How can I work around it? Here are steps to reproduce. Create new ASP.NET Core WebAPI using .NET core Create integration tests in separate project and configure the test to use TestServer() client and get tests to work successfully. Now, separate the controller into its own shared library and refactor project created in step 1 to use this shared library instead. Re-run test which contains the TestServer() class. You'll notice now it fails. See the follwing link for creating the integration tests. Integration testing w/ ASP.NET Core A: Actually I found a solution for now, see diff below: It sounds like this may be bug of TestServer() class and how it is hosting the application during the test run. Here is the line of code in case you cannot read above in image .AddApplicationPart(Assembly.Load(new AssemblyName("WebApiToReproduceBug.Controllers"))); A: In addition to joey answer: There is no need to call Assembly.Load() to resolve this bug. You can use the code below. ServiceHookController is class from a separate project. public void ConfigureServices(IServiceCollection services) { services.AddMvc() .AddApplicationPart(typeof(ServiceHookController).Assembly); } A: For those of you experiencing this during a migration to netcoreapp3.0, I found the above answers work, but you can do this more cleanly by changing the reference in your .csproj file itself perhaps. In my case I changed the first XML line to Credits to: https://github.com/aspnet/Mvc/issues/5992#issuecomment-395408983
- Assistant