I'm migrating an ASP.NET 5 Web App from manually deploying in Visual Studio to deploying through an ARM template. I can successfully provision the website and the deploy claims to succeed, but whenever I hit my endpoint I get a 404. It doesn't seem to be a configuration issue, as if I deploy the same web app into the same container through VS it works as expected.
Browsing through the files on the site, the only difference I can see is that there's no web.config when published through ARM, and I'm wondering if that might cause it.
The way the deploy seems to work is that ARM is calling "dnu pack" on my xproj to create a nupkg, and that deliberately strips out the web.config file. I get the following message:
The following commands will not be exported for global install: web.
I can't see any way of forcing "dnu pack" to include web.config.
Most of the documentation I can find refers to using a .zip file to upload, but that seems to be only for older versions of ASP.NET. Anyone got any pointers?
Related
Trying to migrate a legacy ASP.NET WebForms/MVC hybrid application from Cloud Services to App Services. All runs fine locally in debug Visual Studio (V2022). The app is predominantly webforms but MVC has been retro fitted and is in use for some pages. It's using .NET Framework 4.8.
Deploying directly from Visual Studio. We have created a new App Service and App Service Plan. The site appears to deploy correctly but the endpoint returns the below as raw text, i.e. the web browser doesn't even attempt to render it, presumably as there is no header information specifying html content-type:
Have checked the configuration for the app service, all appears normal (same as other app services that run quite normally). It's set to ASP.NET 4.8 with all the other standard defaults. The default documents includes Default.aspx which matches the application. The application is using Forms authentication and defaults to a Login.aspx page. We have tried removing this and redeploying but we still get the same result. Configuration and Management diagnostics section on the Azure portal shows no significant errors.
In Kudu (advanced settings) if I access the debug console, I find my app is deployed to c:\home\site\wwwroot> as expected, however if I click "Site Root" it flips me to c:\local>
Could it be IIS is pointing to the wrong path for the site?
In the end found some rogue code that was causing the issue. The different paths under Kudo was a red herring.
To diagnose the problem we moved from VS deployment to CI deployment and still had same issue. This meant it was not publishing settings. We compared web config with other solutions that ran fine as app services and found no significant differences. This ruled out IIS settings from web.server section. We checked for errors on the app and found no errors being reported.
In the end we trawled through the code and eventually found something that was URL specific.
I have built a web app in VS2019 that is a .netcore 2.1 application. It builds and runs fine locally in debug and release mode.
I have bought space from a hosting site on there server and have a registered a domain, they stated that they can run .netcore apps.
I have deployed the web app to the servers file server, I have used Visual studios publish functionality and used filezilla, my site is in its httpdocs folder which is where there sample html index file was before I deleted them, now in this It has the webroot folder and the dll's here.
When I look up the website online it shows a 500 error.
I have never set up this type of thing before, am I missing steps, Is there something that I have missed.
Just to note, I have looked up other similar questions regarding this but havent helped.
Assuming you are trying to host this inside IIS, you need the followings to be installed on the server. You can download the same from here.. Please make sure you choose the correct hosting bundle for your application.
Once that is installed, make sure to open IIS and create an apppool. Make sure you select No Managed code.
Then you can add the web site, and assign the above apppool to the website.
Hope this helps. Happy coding <3
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!
Every time I Publish a Web Deployment Package using a Release Build I get this error once I call the Web API;
HTTP 500 Internal Server Error
Could not find file 'C:\SolutionDir\ProjectDir\bin\AssemblyName.xml'
Here is the steps I perform when deploying to the server.
In Visual Studio 2013 right click Project and select Publish...
Check I'm happy with my Publish Profile and click Publish.
Locate the Deploy folder in my Web API Project and copy it to the destination (plus check backups of previous build).
From the server I wish to deploy to I open up Internet Information Server and select the Application I wish to deploy to then right click select Deploy -> Import Application....
Following the Import Application package wizard selecting my deployment package and checking any settings before clicking Finish.
After this process I attempt to test the Web API using Fiddler and receive the error mentioned above. I've tried various methods but nothing has worked so far, the only way I can make it work is by copying the XML files into the bin folder on the server from a Debug build of the project.
What I don't understand is I shouldn't need to do this to make it work, why does Visual Studio / Web Deployment insist the XML exists?
Solutions I've already tried
A: How to prevent the copy of XML documentation files in a release mode build?
A: Preventing referenced assembly PDB and XML files copied to output
A: How to prevent Visual Studio from “publishing” XML documentation files in web projects?
If you create a web API project with certain options it also includes MVC functionality to display web API help pages based on the XML documentation.
I think the Nuget package that will be in the solution is called Microsoft.AspNet.WebApi.HelpPage.
I've never used it, so I'm not up with when it may potentially check for the XML files, but perhaps removing this and the MVC stuff (if you do not use the documentation) will stop it looking for the XML files.
I have a ASP.NET 5 (ASP.NET Core 1) solution here in GitHub which has multiple projects in it. I have been able to build and publish the project just fine on my local machine. But I am not able to publish the same project on my azure web app.
I tried this, this, this, this and a lot more. I tried doing direct ftp publishing, custom deployment scripts,just XCOPY command on the custom script to copy published files from repository to site folder in azure. But nothing seems to work.
The continuous deployment within azure gives me an error "could not find a part of the path while doing dnu publish in the deployment script of azure every time.
Even when I am directly copying and pasting the locally published files to azure site folder via ftp. The site won't run.
I just want to have the site deployed on azure and if possible with continuous integration.
I have spend 2 days trying to figure out a solution. And I have given up on it now. Any help and directions would be highly appreciated.
What .NET Framework version are you compiling against. Sometime back I ran into this and finding the real cause took me a bit. The cloud service guest OS are behind a bit see this.