Newly Published Razor Page App Will Not Run/Open in Browser - asp.net

I have my web app completed and want to publish it. Let me say upfront that it is entirely probable that I am doing something wrong or have made incorrect choices in my publish profile. This is my very first app!
It runs fine with no errors within Visual Studio. It does have a couple of warnings about nulls - would that keep it from publishing? I have eliminated all of them but a couple (which I am not sure how to get rid of at this point - Dereference of a possibly null reference) and as it is a historical info 'view only' app, with no data being able to be modified, is that really an issue?
When I publish, I am publishing to a network folder. The publish succeds, but when I click the application file in the folder, it opens a command prompt window and runs a few lines of code and then stops. No browser opens. I never view the app itself.
Here is what was in the command prompt window:
info: Microsoft.Hosting.Lifetime[14]
Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[14]
Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
Content root path: S:\Visual Studio Projects\Healthy Shots\
My Publishing profile choices are:
Configuration: Release
Target Framework: net6.0
Deployment Method: Self-contained
Target Runtime: win-x86
File Publish Options:
Produce single file
Delete all existing files prior to publish
Databases:
Default Connection with 'Use this connection string at runtime' checked. Below that shows the connection string that is in my app.
Entity Framework Migrations (nothing here)
Any assistance would be much appreciated. Thank you! Please let me know if you require additional information.

According to the output, the application has launched successfully and is running. If you want to see it in a browser, you need to launch that yourself and navigate to https://localhost:5001. Web apps do not launch browsers themselves. It would make no sense for them to do so as they typically execute on a web server which might not even have a browser installed on it. Your IDE might launch a browser when you press F5 or Ctrl+F5 to run the app locally, but that is not the same thing.

Related

Symbols not loading for remote debugging on ASP.Net app built and deployed from Azure DevOps Pipeline

I have an ASP.Net application who's code is sitting in an Azure Repo. The project has a build pipeline that builds on master branch merges. I then have a Deployment pipeline that takes the latest build and deploys local on my web server through a deployment pool I have running on my server. The web application builds with the VS Build task and deploys with the IIS Web App Deploy task. Both work fine.
I have one VM in with Visual Studio that I am trying to use to remote debug the web server. I have VS Remote Tools on the web server and it successfully runs. On my VM, I am able to open VS, attach debugger to a remote process on the web server successfully. The problem is that the symbols are not loading and I'm not sure what the correct sequence of items is here.
First, it doesn't appear that there are any .pdb files in the build produced by the Azure Pipeline. Second, I'm not sure what is the proper way to get the code onto the VM for debugging (Clone repo, vs download zip, etc). Third, I attempted to add a Publish Smybols task to my deploy pipeline, however its generating .pdb folders not files, and I'm not sure where to place these either on the web server, or on the vm.
My background is in classic local TFS setups, so working, building and deploying from Azure DevOps has me confused on how to get remote debugging to work.
OK this is not for the faint-hearted. It has taken me 3hrs to slowly work through this - but it's worth it. Many times has something worked locally, but then when you trigger an Build Agent with CI on a remote server you can't Step through the code with breakpoints.
So this info is if you are using the above situation - Azure build agent and Continuous Integration. If you are using a Publish Profile this doesn't apply.
First things first... The most important parts of this answer can be found in this blog:
https://willys-cave.ghost.io/i-have-a-dream-of-a-single-build-consistent-x-and-simple/
I've added that Url to the wayback machine at archive.org in case it disappears.
So yes the problem is the .PDB files - they need to be included by adding Publish symbols task. in your VSO pipeline.
Note: I had to change the BuildConfiguration parameter to debug (different from Willy's instructions). Otherwise when you eventually start to hit breakpoints the code is optimized and you won't see variable values in the hover-over etc.
In VS 2019 Willy's instruction for Link to the symbols during remote debugging sessions needs reading carefully. I didn't. There is a better image on:
https://devblogs.microsoft.com/devops/vsts-is-now-a-symbol-server/
I include the screen capture here:
Importantly you need to add your VSTS hostname into the list of Symbol Servers
Now mine still wasn't hitting the breakpoints and I found this page (which is generally about using the slightly different method of Publish Profiles), but I noticed some more components were loaded into IIS... Yes! You may need these too.
https://learn.microsoft.com/en-us/visualstudio/debugger/remote-debugging-azure?view=vs-2019
So the most important image I will paste here:
You need to add IIS Management Scripts and Tools to your IIS installation.
That should do it. Also I run my remote debugger as Administrator, attach it to the w3wp.exe (show All Users Processes) and if it doesn't appear - reload the remote page and Refresh as if the pool goes to sleep you won't see it in the list
Good luck!

Anywhere Administration application with the Chrome Simulator

I am trying to setup the Anywhere Administration application in Maximo. I have altered worklight.properties with si.adminmode=true in the MobileFirst Studio and done a buikld all. I have also run Anywhere-Admin-Loader allApps.
I can see my apps and their lookUp data resources but when I put a query against the resource in the admin app the simulator does not honor it an returns data based on the clause in the app.xml.
What step have a missed in the Studio?
Assuming you are using a standalone mobilefirst server after making the change in worklight.properties, you have to rebuild and redeploy the runtime war to the standalone server and restart the standalone server.
If you using the embedded server of MobileFirst Studio to run the runtime, as long as you have "Build Automatically" set at the project level it should be rebuilding and redeploying the war automatically to pickup the si.adminmode=true change. You might have to restart the server from within Studio to get these changes to be picked up.
From the application itself, you have to logout and log back in to pickup these administrative changes.

Breakpoints not hit when debug website project after update to VS 2015 Update 3

I have a web project (DNN module) that I am developing and I recently updated to Visual Studio Professional 2015 Update 3.
I am using IIS 10 on a windows 10 PC
When I try to F5 / Debug my app I get the following warning on any breakpoints:
the breakpoint will not currently be hit. no symbols have been loaded
for this document
What I have tried to fix this:
I enabled directory browsing inside IIS 10
I Run VS in admin mode / elevated permission
Updated MS ASP.NET and Web Tools extension to latest version
Updated MS ASP.NET Web Framework and tool extension to latest version
cleared out and re-downloaded all debug symbols
Clean and rebuilt in both release and debug mode
Made sure modules runAllManagedModulesForAllRequests="true" is set in
system.webserver of web.config
Restart IIS / refresh application pools, and restart website
using a different port for the website
obviously restart computer / and visual studio
I am at a total loss and really need help. I can not figure out why my breakpoints are not being hit, when I debug the site no errors are thrown and the site runs fine.
Other Attempts:
From this SO thread I tried:
Install Update for Microsoft Visual Studio 2015 Update 3 (KB3165756)
From This SO Thread I tried:
disable "just my code" in debug general settings
From User suggestions:
I have tried attaching directly to the w3wp.exe process - no breakpoints hit and visual studio crashes when I try to stop debugging. Also, as soon as I attach the debugger, the website stop workings all together
Question
Can someone help me figure out why my break points are not being hit when debugging from visual studio.
EDIT # 1: Additional attempts
When I debug my application and open the Debug -> Windows -> Modules window I do not see the name of my projects dll / pdb file in the list of Modules. I tried going to Debug -> Options -> Symbols and clicking the Load All Symbols button.
I included a screen shot. My dll or project is named krisisShifts so the dll created in the obj/Debug folder is krisisShifts.dll and KrisisShifts.pdb etc. The blue mark on the image shows the dll is not listed in the loaded modules. Also I included the default attached process Visual studio is using to debug the site marked in Red.
I also deleted the site and application pool from IIS and recreated them with different names, site displays fine, but no breakpoints hit
EDIT 2: Attach to process now works
Not sure what I did. I have been fighting with this all day and afer restarting the computer and visual studio numerous times I can now attach to process w3wp.exe and the breakpoints are hit.
However hitting F5 still does not work. The site loads but no breakpoints are hit and I can see that my projects .dll is not added to the debug modules list (but it is when I attach to process).
I feel like I am closer but still can not figure out why my project .dll is not loaded in the debug modules when hitting f5.
Are you able to attach directly to the w3wp.exe process, and if so are your breakpoints hit then?
Menu > Debug > "Attach to process..."
Check "Show processes from all users"
Look for a process named "w3wp.exe", with the username "IIS APPPOOL\{IIS site name}"
Click "Attach"

ASP.NET 5 IIS8 dnx fail

I have a problem with hosting an ASP.NET RC1 application inside IIS.
I've read through similar issues here on the site, aswell as went through official Microsoft documentation, but to no avail. I simply cannot make the app start inside IIS8 which is a must in this scenario, as I need to use it with an SSL certificate, and no relevant logs are shown unfortunately.
App is packaged under dnx-clr-win-x86.1.0.0-rc1-update2
If I try to start it inside my local VS2015, it works flawlessly. If i run the Web.cmd on the server machine from command line, app starts without any problems. However, when I try to run it through IIS, event log catches the following.
Faulting application name: dnx.exe, version: 1.0.0.20309, time stamp: 0x56e05cbb
Faulting module name: ntdll.dll, version: 6.2.9200.21815, time stamp: 0x56eaff87
Exception code: 0xc0000374
Fault offset: 0x000db583
Faulting process id: 0xae4
Faulting application start time: 0x01d1aba4b38c38e7
Faulting application path: C:\inetpub\wwwroot\approot\runtimes\dnx-clr-win-x86.1.0.0-rc1-update2\bin\dnx.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: f1f534cd-1797-11e6-9404-000d3ab185aa
Faulting package full name:
Faulting package-relative application ID:
It seems to me like it is using a wrong dnx version, but this shouldn't be possible as i published the app with:
dnu publish --runtime active --no-source
First of all thanks Clint for pushing me in the right direction.
Unfortunately I ended up spinning up a new Windows Server 2012 instance, and installing everything from the grounds up, which seems to work great at this moment. I have probably messed something when initially setting up the server, but it was a test one so no harm is done. I have a few observations for DNX to IIS publishing, which could help others with similar problems or at least mitigate at least some of the problems.
Very important steps:
If publishing from command line, publish with dnu publish --runtime active. Add --no-source when you are sure you don't need to make any quick changes to make the app work so it compiles into NuGet packages.
Try to run the app manually by running web.cmd from the publishing folder from command line. If this doesn't work, IIS is least of your problems, and you need to resolve the app startup first.
Install IIS locally on your development machine, and try to make it first work with that one, which will help you understand which issues are happening to you and how to resolve them on the real web server.
Use Event Viewer -> Windows Logs -> Application to catch .NET and HttpPlatformHandler errors during startup
Enable stdout inside wwwroot/web.config for your solution.
Battling different issues:
1. Various http 4xx and 5xx errors.
Ensure that Http Handler 1.2 is installed. If you are not sure, check the add / remove programs section in control panel, where version is clearly visible. If using a x64 system, you need to install x64 runtime
Check that you have unlocked handlers in IIS
Check that Application pool is set to No Managed code (32 bit app support was not required in my case)
2. I'm not sure I published to a good folder
Create a folder for your web app inside your wwwroot folder e.g. C:\inetpub\wwwroot\myApplicationName
Copy publishing files to that folder. Structure should be as follows:
C:\inetpub\wwwroot\myApplicationName
approot
logs
wwwroot
Create a new website in IIS and attach it to your application pool that is set to no managed code
Set the application folder to be C:\inetpub\wwwroot\myApplicationName\wwwroot
3. Event Viewer - DNX Could not write to logs folder
This is an issue with IIS permissions on the logs folder from your publishing artefacts. Right click -> Properties -> Security on the logs folder and Add permissions for the following user.
IIS_IUSRS (permissions: read and execute, list, write)
Once you do this, restart the website, and check if this issue is gone. If Event Viewer is not logging anything, check if there is a file generated in the logs folder where you should get the next troubleshooting hint.
NOTE: If you publish an app update, and you overwrite the logs folder accidentally, you will kill its permissions and this issue will return. After the initial publish, just copy approot and wwwroot, and leave the logs intact to avoid this.
4. Unable to load application or execute command 'Microsoft.AspNet.Server.Kestrel'. Available commands: web
Try to run a dnu restore before publishing manually
Ensure that you have published with --runtime active
First make sure you have httpPlatformHandler v1.2 installed. Then follow the steps and issue resolutions here. If it still is not working, I've heard some people have resolved their issues by adding a Configure1() method in Startup.cs. See the details here.
I got one of my projects working with IIS but it was a struggle. So I decided to wait until the next release. I personally don't think it's worth bothering with right now. Because it relies on dnx which is being replaced in the next release. So whatever you do to get it working, probably won't be relevant after the next release.

Microsoft Release Management Server for TFS 2013 - install issue

I've been trying to install the new Microsoft Release Management app that has just been released to MSDN and am having issues
It consists of a server side component for TFS 2013, and a client side component for VS2013
The server side component runs through and says that it is installed fine, but then i can't seem to connect the client side part up to it
After a bit of investigation it seems that the web services site that is installed on the server side is not working properly
It is installed on a Windows 2012 box that is also running TFS 2013, SQL 2012, and SharePoint 2013
If i browse to the newly created ReleaseManagement website I get a 503 (Service Unavailable) message.
I checked out IIS and the app pool had stopped
in the application event log I could see a load of messages saying "current configuration only supports loading images for x86 processor architectures"
I thought this was possibly to do with the "Enable 32-bit Applications" option in the IIS app pool (was set to FALSE)
I changed that to true and tried the site again. This time the app pool doesn't crash, but I get ASP.NET errors stating "Could not load file or assembly 'Interop.ActiveDs' or one of its dependencies. An attempt was made to load a program with an incorrect format."
Has anyone managed to install this yet? Any ideas on what's going wrong here?
I know it's very new, but I'm struggling to find much information about the product at all
Thanks a lot
Here is a link towards some documentation regarding this problem. As pointed out in the comments, it is related to a bug caused by SharePoint: http://support.inreleasesoftware.com/entries/24794668
Interesting section:
The request failed with HTTP status 503: Service Unavailable.
This error message usually means that the InReleaseAppPool application
pool is stopped. Please ensure that it is started. If the application
pool stops after some time by itself, it might be due to a bug caused
by SharePoint 2013. Validate your problem by looking at the Event
Viewer. Confirm that your error is similar to the following:
Event Log Error Event ID 2282
The Module DLL 'C:\Program Files\Common Files\Microsoft Shared\Web
Server Extensions\15\isapi\spnativerequestmodule.dll' could not be
loaded due to a configuration problem. The current configuration only
supports loading images built for a x86 processor architecture. The
data field contains the error number. To learn more about this issue,
including how to troubleshooting this kind of processor architecture
mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349.
We can apply a quick fix using this command
appcmd.exe set config -section:system.webServer/globalModules
/[name='SPNativeRequestModule'].preCondition:integratedMode,bitness64
Or you can manually enter the preCondition entry in the
ApplicationHost.config file
More information can be found here:
http://blogs.flexnetconsult.co.uk/colinbyrne/2012/11/11/RunningA32bitApplicationAlongsideSharePoint2013Problems.aspx
FIX:
the user which you specified to run the TFS service needs "log on as a service" and "Log on as batch job" permissions. I've set that up via GPO.
This solution worked for me. I execute this command
appcmd.exe set config -section:system.webServer/globalModule/[name='SPNativeRequestModule'].preCondition:integratedMode,bitness64
in C:\Windows\System32\inetsrv and C:\Windows\System64\inetsrv.

Resources