appsettings.json not read in .Net Core 3.1 in basic Blazor template - .net-core

I have basically installed the default Blazor WebAssembley template, with .Net Core server.
Ran the app, worked fine, comes with the initial migration for identity which ran and created the database tables so I could create an account login etc.
Changed 1 view file razor file and now the app will not run. In debug mode I can see the it seems to be empty, so the application falls over when it tries to connect to the DB with an empty connection string.
I just ran through the exact same steps on another machine and the same result, yet the only files changed are the appsettings.json and a razor file.
appsettings worked fine, then without changes no longer works. Any suggestions on where to investigate would be appreciated - this is my first step into .Net Core.

So just in case anyone else comes across this problem. I had the application open in another browser window, although I was not interacting with it.
Once I closed all the browser windows and ran the application again I no longer had the issue.
One thing to note, I am running IIS Express with the option "Do not start browser" so that VS does not keep closing and opening a new browser window.

Related

Trouble with 'Microsoft.ACE.OLEDB.12.0' in ASP.Net

I have two apps that use the Microsoft.ACE.OLEDB.12.0 provider to open Excel files on the same machine. One routine is a c# compiled app that works fine..the other is a non-compiled asp.net app that uses vb code behind that we are trying to re-host that throws 'The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine.' errors when opening the Excel file - which appears to me to be bogus since the other app runs fine on the very same machine. I have checked the app pools for both and they appear to be set up identically...they both have 32 bit checked and are using the same .Net framework version. The web.config for both of them has the same connection string with the same options (only difference is the name of the connection)..We even re-installed the dll. I tried copying the dll to the bin folder for the aspnet app, but no luck there either. I would compile the asp.net app, except it uses ColdFusion for part of its output... I am hoping there is someone out there that has run into this particular issue and might have some pointers on where to look to solve this... Or maybe a different direction?

Classic ASP, IIS8 & VB6

I was hoping to get some people's expertise as I'm currently outside my main domain. I'm currently working for a client that has an old system written in VB6 COM Objects. They use these to do basic Database interaction. These COM Objects are used in a Classic ASP website.
I've been tasked with getting the site up, running and in a build-able environment (Windows 8.1 is what they want to use).
I've been working through all the blockers associated with this and I believe I have it in a running state (as in I've configured IIS and been able to run the website, log in and click around and so far nothing has crashed).
I can make changes to the code in Visual Studio 6 Enterprise and those changes are working so I'm confident I've got that about 90% of the way there.
I've now got 2 problems both somewhat related:
Problem 1:
Problem 1 is now debugging, both the ASP & the VB code.
I can put a break point in the VB code and 'Step-Into' it (to attach) and then run the site and the code that runs in the global.asa file gets run and hits that breakpoint no worries, can step through as I would expect.
The problem then comes when I go to 'login' to the system. I use the same user/password that works if I'm not 'attached' the system crashes with a "An unhandled exception ('Error in loading DLL') occurred in w3wp.exe [3284]." - If i try to load up a debugger from this Visual Studio 6 is not an option in the list. If I then detach and I can do everything as before.
Does anyone know what could be causing this? Or have another way to be able to debug/step through this?
Problem 2:
They had previously been 'running' the website through Visual InterDev 6.0 - they could add breakpoints to the Classic ASP code and be able to step through then into the VB components.
The problem is that although I can install InterDev on my machine, I can't actually set it up. It appears to need FrontPage Server Extensions which although they can be 'installed' on IIS 8.5 they don't seem to be officially supported by Microsoft. So I've managed to install it without any issues but it doesn't seem to be configured in the same way that InterDev needs it to be able to setup a solution file/run from it.
My Question is this: Has anyone been able to configure FrontPage Server Extensions in a way that InterDev works?
OR is there any other tools I could use to 'run' a Classic ASP site that would allow me to debug it properly.
Let me know if you need any more information.
Thanks in Advance,
Michael
I think you actually don´t need Interdev in order to debug the classic ASP code. Just create a blank solution in Visual Studio and add all the classic ASP files from the virtual directory (editor and debugging capabilities for classic ASP files are still supported, even in the latest version of Visual Studio).
I assume you run the web application in your local IIS... once you have the solution, open the script of interest, put some breakpoints and than attach the Visual Studio debugger to the web server´s worker process (which should be w3wp.exe). Maybe you need to manually select the Script code type (automatic code type detection might not work).

Changes to razor view not showing

I have made some changes to a view in my ASP.NET MVC3 application, but the changes I have made are not showing up when I test/debug the site within the browser. The changes I am making are simple text amendments to the markup.
I am using the Visual Studio development server for testing the application.
The odd thing is, I have tried publishing these changes to IIS and the changes I have made to the view are working when I test the application using the IIS server.
It is only when testing in the Visual Studio environment that this seems to happen.
Thanks,
A common problem i've run into is when you are not using IE and you close the debug session, but not your browser.
This means that the "IIS/development server" is still running in your system tray, but it is running on the old compiled code, if you hit ctrl + shift + b, you build your entire solution and re-publish your code to your development server. this allows you to hit refresh (F5) in your browser and the changes you've made to the razor view should now be reflected in your browser.
Are you using IE? Maybe deleting the cache or using another browser should work? I've had a lot of problems with that :D
Solution is to use IIS Express. For some reason, the VS development server doesn't recognise changes to code behind - nothing to do with caching on the browser.
However the location of the source code as suggested in other answers is important - it works for me using the c:\windows folder or c:\users\DefaultAppPool - apparently it has something to do with security to ensure.
Only applications running under the 'DefaultAppPool' identity are permitted under IIS. So, for anyone using a VM and mapping the host OS code folder you won't be able to rectify this unless you copy to a local folder in the c:\users\DefaultAppPool folder.
You may also now have difficulties accessing the SQL server database established for the Membership Provider under ASP.NET. For more details on how to fix that, I've posted on my blog.

Debugging ASP.NET in IIS 7

I have searched all the usual but come up empty. I must be doing something silly!
Simply I created a new project, ASP.NET Web App, and wish to use and debug it with the local install of IIS 7.5 on my Windows 7 x64 box.
According to what I have read it should be a simple process; my issue is that Visual Studio will not stop at breakpoints nor at errors etc.
I just don't get it:
Visual Studio is attaching to the w3p process for me automatically.
If I hover over the breakpoints it shows a message saying the same, that it is in the same w3p process.
I am in Administrator context. I manually ran it like so to be sure but in any case if you are an admin it runs like that anyway.
Some notes:
I do not wish to use IIS Express as I require native IIS 7.5 for my tasks, however it does debug in express - no surprise there.
As mentioned above, all this is being done locally.
The path of the virtual directory is pointed towards the project files, as set by Visual Studio 2010. It even set the Network Service as read on the folder structure.
When debugging from VS the web site runs fine, just debugging is the issue.
Maybe it is permissions? The Default App Pool is using the ApplicationPoolIdentity not Network Service... Should it be? I had assumed they we.re one and the same essentially. Although I changed this and no luck unless I didn't do something I should of
Keep in mind here that my issue is semi-unique in that I am not receiving error messages, not even in the event logs... For all intents and purposes it should be working fine, just it isn't.
VS and IIS, and all updates, are applied to date.
Note: I'm familiar with IIS7.5, I run my own public web hosting server. I just never tried to debug
Note: It is Visual Studio 2010 Ultimate
Thanks for your time.
Sigh!
I went back to basics... Uninstalled IISExpress and tested; It worked! Re-installed IISExpress; It worked!.
I guess installing IIS7 native after IISExpress did something screwy? I had ran the register ISS command on IIS7 when I installed it.
Right, so now I have both installed in tandem and they work fine. Thanks for all your help guys, appreciated.
you can try right-click on project in VS go to properties select web from left menu tab. Check if ASP.NET debugger is checked and also you can select Use Local IIS Server and give localhost url there (in project Url textbox) and then Say start debugging from VS and put breakpoints.
I had a similar issue the other day, I attached the debugger to the wrong w3p process, make sure you attach it to the one the app pool identity is running under.
I wanted to write it as comment by I don't think I can add pictures..
Are you sure you are running the same version of dll?
Is your breakpoint filled like this?
or hollow like this?
1st go to ,Program and Feature in control panel and then in that turn on or off windows features. and now check all check boxes(activate features) related to Internet Information server & windows service managers. once this is done run your visual studio as administrator and then attach to right w3p process.

This application is currently offline

I was working(learning) with Data bound controls in ASP.Net and suddenly got the error:
This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.
I started searching it on google but ended up with no helpful solution. I was not able find app_offline.htm file also. And then I suddenly tried to open my project in browser again and it opened successfully and now its working. And now I have observed that in between as I am working on the project it shows this error in between (cant say when and on what criteria) and then after some time it starts working again. Can anybody help me why its happening?
I am using ASP.Net4.0 and Sql Server Express Edition.
EDIT
With somemore searching on google it seems that this gets created automatically in the solution. If we delete it the program works fine and even if you do not delete it gets deleted after sometime by itself. but will be created again after some time.
Its hard to post any code because there is no code that is giving error. But when I press (ctrl+F5) to open my project its giving error. Still for reference I created a webform Review.aspx based on a masterpage. I created a combobox and a gridview inside it. Here Combobox has some collection of numbers (GenreId) and when you select a GenreId it do Autopostback and Gridview shows the entry associated with the selected GenreId.
And then I tried to debug it in a browser, its giving error (for some time).
Here is the reason. have you try after closing all the design windows?
SQL Server 2005 express edition does not support multiple processes.
Only single process can access database at a time. So when a database
is accessed through visual studio, ASP.net runtime cannot access the
database. This will result into the internal server error. To prevent
this, VS 2005 places app_offline.htm file in the application's root
directory. The file contain above message. This causes ASP.net to put
the application in offline mode. Please note the accessing database
means opening any component of the database (I.e. table, view, stored
procedure etc.) into the design window. When design window is closed,
VS 2005 removes app_offline.htm file making the application in onliner
mode again.
http://www.codeproject.com/KB/aspnet/app_offline.aspx
Sometimes the ASP.Net DLLs aren't properly flushed from the cache, which can cause issues between builds. I would close visual studio (and make sure the web server the app is running on is stopped) and then delete any ASP.Net temporary files that are typically located in the C:\WINDOWS\Microsoft.NET\Framework[Version Number] for your application to help resolve the issue.
the app_offline.htm filename was introduced in ASP.NET 2.0 to make it much easier to show to visitors that the site's currently offline so that administrators could more easily upgrade the system or place a new version into production of the site. After removing that particular file the upgraded site's back available for people to see.
For more information take a look here: http://weblogs.asp.net/scottgu/archive/2006/04/09/App_5F00_Offline.htm-and-working-around-the-_2200_IE-Friendly-Errors_2200_-feature.aspx.
there is a file app_offline.htm on the root of your project.Remove it and build if you don't wanna see again
If you can not find the App_offline.htm file,
Go to the App_Data folder and there you will find the app_offline.htm file.
Right-click on the file and select Delete.
Good luck!

Resources