I am trying to get my Asp.Net Core 3.1 project running from inside Visual Studio on IIS.
I ran through the steps and it seems to run my Swashbuckle Swagger page, but it hits an error on finding the swagger.json file. When I look at the dev tools, I see I got a 404 when trying to load the swagger.json file. The physical path it is trying to load from is:
C:\inetpub\wwwroot\swagger\v1\swagger.json
But my code is not in inetpub, it is in my development folder. What is even more odd, is I tried this on another machine and it works. So it seems like it should be something to do with how IIS is setup.
I checked my IIS Site settings and the physical path is set to my development folder (not inetpub). And when I hit the "Explore" option in IIS it loads my development folder.
I copied swagger.json into C:\inetpub\wwwroot\swagger\v1\ and it worked (though I then encountered other errors).
Why is IIS trying to use inetpub to find the swagger.json file instead of my development folder?
Related
I'm having issue deploying ASP.NET MVC app with precompiled views. Until now I was not precompiling views and app has worked for years flawlessly. If I precompile them, the site works on first start just as you'd expect. If I however restart it from IIS, I start getting 404.0 errors. The funny part is: if I change app's non-essential configuration in IIS, IIS restarts app by itself and it comes to life. If it gets recycled or restarted, then it goes back to 404.0s.
I noticed error page describes incorrect physical path. In the screenshot below the physical path is C:\wwwsites\workpal\settings. In fact 'settings' is controller name and is a folder at path: C:\wwwsites\workpal\views\settings which contains index.cshtml. Also, should StaticFile be used here? I'm a newb, but to me it looks like IIS doesn't have a clue how to resolve URLs.
The error
Application is running .NET 4.7.2
IIS 8.5
Application has worked for years without precompiled views, no issues. We used .NET 4.5 earlier, but I doubt it's the reason. I get same results with 4.5.
The only change is turning on precompiled views in VS publish settings. I have tried every 'Advanced Precompile Settings' configuration - same results.
Application with precompiled views works on first start, when IIS detects change in app's directory or when I change non-essential app setting in IIS.
Application doesn't work when recycled or when restarted manually.
I've tried fresh AppPool and fresh Site - to no avail.
Tested on two unrelated servers (physical machines).
I have forked a Visual Studio-made website on github and am trying to open it with JetBrains Rider. It has no .csproj file (but does use a .publishproj file - think this is Azure related). As such Rider finds no projects to run and I can't seem to set up a run configuration for the local web server.
When I run it in VS I can hit F5 and the localhost webserver starts up and servs my browser the pages nicely. Anyone know how to setup the same in Rider for a ASP.NET Web Site ?
Cheers
EDIT: This is the root of the difference I'm seeing - Rider is fine with Web Apps that have .csproj files but can't seem to create run configs without
ASP.NET Web Site or ASP.NET Web Application?
I have built my first ASP.NET web API in MVC, when I debug the application from Visual Studio everything works perfectly.
Now I need to get these API's on my server...
I have tried copying the project files to the website root which usually works for normal MVC apps with views, and I have also built the project and copies the file full of DLL's and an exe to the IIS root.
Obviously, neither of these worked, anyone know what I am missing? Perhaps something I have to do with IIS?
I have now tried "publishing" the project and when I try to access the site this happens...
Thanks in advance!
Build the application then publish it. Copy the published files to a favorite IIS folder. Ensure you select the right version of ASP.NET in the server for your application in the application pool.
When you publish and get an error such as this it is often related to a configuration issue, or other non-supported .NET Runtime issue.
For best results, if you can get to the Event Viewer for the server a detailed error should appear there outlining the root cause of the issue.
If you don't have access to the server directly, updating the <system.webServer> section with the below should get you a detailed error.
<httpErrors errorMode="Detailed" />
Just please note DO NOT LEAVE THAT LINE IN PRODUCTION!
I made a virtual machine on azure to host my asp.net mvc 5 website. I made a directory in iis on the machine and pointed it to my domain. I first put the default iis.html page and went to it. This works.
Now I put all my asp.net mvc code in that folder and I get "500 server error". I don't know why.
I tried to put in my web config
<customErrors mode="Off">
Yet this did nothing. I don't know why it is failing nor how to check. There is nothing special with this website(just controllers and views...not even a database).
I am not sure if I need to install anything more to get it to work. The vm is windows server 2012.
Follow these steps:
Verify installed MVC version in the server (windows\ assembly folder)
Verify application bin folder which should contain appropriate dll(s) (website/ virtual directory maps to a physical folder, bin should be under the root with required binaries)
Also verify MVC views ('Views' folder should be just under the root)
Verify Web.config, which should be updated properly
Application Pool should be running under appropriate .Net version (Run -> inetmgr -> Application Pool -> Advanced Settings -> .Net Framework Version)
I have saved my website in the wwwroot folder. when i am running it through Visaul Studio 2008 it s running absolutely fine with path
http://localhost:3840/GettingUserId/default.aspx
but through IIS it is unable to resolve the images URL , not even the links to other pages r working (Parser Error). The path is
http://bhukrk106154d/GettingUserId/default.aspx
I am using IIS 5.0.
Is there any IIS setting that I am missing out.I have simply copied the same website folder inside the C:\Inetpub\wwwroot folder
I have seen parser errors becasue the website is trying to use an old framework version.
Go to the default website properties in inetmgr -> go to asp.net tab -> make sure that asp.net version 2.0 is selected.
If you can post the error message it will be usefull too.