I'm getting an error with an application that's using basic authentication for IIS 8. When I start the application it takes too long to run and also it doesn't load the .js and .css files.
The weirdest thing is that the same application loads correctly in other 3 machines but mine.
I defined an Application Pool with my network credentials and on Basic Authentication I also defined the host.
In my MVC project, on Web tab the project url is something like "http://localhost/MyAppName".
Is there anything that I could do to solve this?
Not being able to load .js and .css is usually the case when your application pool is running in Classic mode. Try switching it to Integrated. Also, make sure your pool is running v4.0 .NET Framework.
Related
I deployed ASP.NET core 2.2 application to IIS 6. It is working and displays all forms. I have a request to have this application to be part of big website. I copied application to another directory and changed hostingModel from inprocess to outofprocess in web.config file. Now the application can be viewed with other applications, however it does not display any ViewComponents in it. Any advice will be greatly appreciated.
Thank you.
I was using JavaScript to invoke ViewComponents and it was worked good when the web application is stand alone. However, if it is a part of web site it is not working. I did not find the reason, I just set invocation of ViewComponents in Razor page, instead of JavaScript, and it started to work normally.
I am trying to get my code to run alongside, in process, with an asp core web site.
With .net framework there is an option to create a module. Then, in order to "inject" that module so that it is run when the site runs all I need to do is add the module to web.config or launch it from a .cs file from \app_code.
With asp core, there is a concept called middleware but in order to add a middleware, the user has to write it into their startup code.
I need a way to run my .net core code when the site has started (first page accessed) without requiring the user to change their code to do so. Changing config files after deploy is OK but not compiled files.
Anyone know how to do this?
Thanks.
I see 2 options here:
Hosting startup assemblies
An IHostingStartup (hosting startup) implementation adds enhancements
to an app at startup from an external assembly. For example, an
external library can use a hosting startup implementation to provide
additional configuration providers or services to an app.
IIS modules with ASP.NET Core - you may still be able to inject your module in case you run the app on IIS. Add a web.config manually into the root directory and configure your module in there.
Currently I maintain an application that runs as a Windows service, reads messages from a message queue server, processes them and puts the result back into the message queue server. But it also contains a health monitoring component that is accessible through a web API.
It is implemented as a console app that uses Katana to self-host the health monitoring sub-system.
I'm now trying to figure out if we can move this to .NET Core and ASP.NET Core once they RTM. I know the Windows Service part cannot be ported, but I could also run the console app as a detached Docker container to basically achieve the same thing, in terms of main functionality.
But how will the health monitoring work? From what I can see the Katana project has been updated to ASP.NET 5 (which I guess is ASP.NET Core 1 before the big rename), but it does not run on the .NET Core CLR. Katana will require the full CLR. So that means Katana is out.
Does this mean that the way we build our app is impossible with .NET Core? Or does hosting the app through Kestrel not rule out the possibility of running code before the first request? With IIS the app does not live until the first request (unless you use the auto-start, but it's more of a speed-optimisation than have the app behave like an "allways-running-app") and generally the app is request-based and not continually running. Background threads in a IIS hosted app are a really bad idea.
Is this the same with Kestrel? Or will DNX start your app and keep it running until it's shutdown, much like a console app, so we can run all the background threads we want?
It follows the console app model. Katana is actually more the spiritual predecessor to kestrel. It is invoked for normal ASP.NET Core projects from the Main method with a normal method call. There are countless tutorials how to setup a server in RC1 (see Startup.cs Main method) and some for the upcoming RC2 (there is a builder for it). That would allow you to do both, your app code and your web api based monitoring, in a console app. Kestrel and DNX are not at all an application server like IIS. Kestrel is a plain HTTP server library and nothing more. You start it up and it listens from that moment on.
Nevertheless, you have to adjust your WebApi 2 and Katana based application to the new ASP.NET Core interfaces and middleware concept. But that should be easy compared to your message queuing adaption.
I have an ASP.NET MVC/WebAPI mixed project which runs just fine in the VS2012 development server. It has a standard MVC {controller}/{action}/{id} route, as well as an additional WebAPI route api/{controller}/{id}. Requests which start with /api/... are directed to WebAPI, the others to normal MVC.
When I deploy it to the local IIS, the normal MVC routes are working. However, /api calls to WebAPI are resulting in the exception
Access to the path 'C:\inetpub\wwwroot\myapp\web.config' is denied.
Then I tried to set the proper security permissions on the inetpub folder and its subfolders. This didn't help anything, and because the normal MVC requests are working, I don't suspect the problem to be security-related.
Then I started Sysinternals Process Monitor to see what w3wp.exe is doing during the request. As it turns out, IIS looks for web.config here:
C:\inetpub\wwwroot\myapp\api\web.config
C:\inetpub\wwwroot\myapp\api\mycontroller\web.config
Of course, there is no web.config there.
How can I set up IIS to recognize both routes?
I do not believe this is a problem with your routing. the problem is the permissions given to IIS I run into this error from time to time. Depending on the app pool identity you are running under you need to provide permissions to that entity. Here is a link to a very thorough explanation
IIS AppPoolIdentity and file system write access permissions
Basically right click your project folder, go to properties, click the security tab and and you will see Group or user names. These are the allowed entities to perform read and/or write actions to that directory. Click Edit then Add; from here you will then "Enter the object names to select" typically IIS follows under IIS_IUSRS again this depends on your app pool configuration from here you should move on from the error mentioned!
I hope this helps!
Has anyone been able to get the MVC mini profiler working on IIS 6? I've set up the profiler in my application and it works perfectly in Visual Studio, IIS Express and IIS 7.5 but when I put the exact same application onto IIS 6 it won't work.
The problem seems to be around loading /mini-profiler-includes.js, I just get a 404 response. I've checked the route table and the correct routes have been registered by the profiler but apart from that I'm not sure what else to try.
On IIS 7, ASP.NET by default runs in integrated mode so the ASP.NET runtime will handle all requests, however on IIS 6 ASP.NET only handles extensions explicitly listed in the mappings section.
When the request comes in for /mini-profiler-includes.js IIS sees the .js and tries to serve the static file but as the file is "generated" by ASP.NET the handler never gets hit and a 404 error is returned.
In order to fix this you need to add a wildcard mapping to IIS so all requests get handed to ASP.NET. This blog post has a good walkthrough of the process.