How to debug a class library on Azure App Service? - azure

I have a .NET application running in Azure. It has a library linked to it, but its source code is in a separate solution, and I need to debug this library. How do I link this library in Azure, and connect the debugger?

In .Net Application , Right click on the Reference folder and browse your class library and select the dll file (YourClassLibraryName.dll) from the bin folder of the class library.
dll Reference will be added in the .Net Application Reference folder.
Build and re-deploy the .Net Application.
If you have the project's dependencies, using Visual Studio to deploy (via publish profile) will automatically upload all of the project's dependant projects/ libraries.
Publishing your Solution will automatically publish your dll's.
The bin folder and its contents are copied to the target machine when the project is published.
After publishing the application,check whether all the files and dll's exists in the bin folder
Path - Azure Portal=>Azure Web App=>Advanced Tools=>Go=>Debug Console=>CMD=>site=>wwwroot=> bin
You can see the referenced dlls with extension .dll and .pdb
In VS, Add the namespace of the class library and Set breakpoints in your code where you want them.
To begin debugging, press F5. Visual Studio will identify the module load, load the symbols, and then stop at the breakpoint.
In Visual studio => Net Application => In Publish window = >Hosting Settings => Click on Attach Debugger option

Related

How to run/debug Azure Cloud Service locally on Visual Studio Code?

I have an Azure Cloud Service solution in Visual Studio 2017 which I debug with Emulator Express.
I'd like "migrate" from Visual Studio to Visual Studio Code. I mean that I'd like to be able to run/debug my cloud service(web role project) in VSCode without the use of Visual Studio at all.
My solution has two project:
Service project - contains .csdef, .ccproj and multiple .cscfg.
Role project - contains the .csproj file and the rest of the sample web role project.
I've tried:
I'm building both of the projects with msbuild, the same way it's been built in visual studio. The problem is running the site locally.
Run a local site with IIS Express VSCode extension and configure the web role project root as site root. It didn't work, I tried to browse the site but I got a notification that the folder of the site can't be viewed as a directory. When I think of it this option is missing all the configuration that is defined in the Service project so how is it suppose to work? Does IIS Express can run an Azure cloud service app locally? Maybe I configure a wrong path?
I've tried running csrun.exe command multiple times with different arguments. Something like this:
"C:\Program Files\Microsoft SDKs\Azure\Emulator\csrun.exe"
/run:./csx/Debug/roles/WebRoleProject/approot;./ServiceConfiguration.myconfig.cscfg /launchBrowser
/launchDebugger:%systemroot%/System32/vsjitdebugger.exe
It gave me the following error:
The compute emulator had a error: Can't locate service descriptions..
I also saw here that compute emulator(csrun.exe) needs visual studio opened as administrator, so maybe it's not possible to run it without it..
I’ve verified this question with the Azure Cloud Compute team and this is not supported in VSCode, they only built an extension for Visual Studio.

Visual Studio only publishes hostingstart.html to Azure

I have two ASP.Net Project. Project A is an earlier/older version of Project B. I used the publish functionality of Visual Studio to publish the .web project to Azure. Project A seems to get published successfully, and I can go to its Azure website in Chrome. But project B seems to succeed but when I browse to its site, I get a default Azure page stating "Your App Service is up and running".
Within Azure, I then go to Project B -> Development Tools -> Console and I simply enter ls to list the root directory contents. I simply get hostingstart.html.
When I do the same with Project A, I get: App_Readme Content Global.asax Images NewImages Scripts Views Web.config bin favicon.ico hostingstart.html packages.config
When I did the publish, I had Visual Studio running in Administrator Mode.
Also when I use IIS Express to locally deploy/publish, both sites load up and work fine.
I did not originally work on the two Projects. I simply inherited them, so I wouldn't know what was changed between A and B.
Is there something I have to enable in Project B to allow all the required files to be included in the publish?

How to add TypeScript to Visual Studio 2012 ASP.net web forms web-site?

I'm trying to add TypeScript to an existing:
web-site (not a web-application)
web forms (not MVC)
Visual Studio 2012
I think, at a fundamental level, the problem is that an ASP.net web-site has no project. This means there is no ability to define "Build options". An ASP.net web-site cannot declare that a *.ts file should have a build action of Compile, since without a project file there are no build actions.
Obviously i'm not going to convert to a web-application (due to the unresolvable disadvantages of a web-applications).
Having said that, how do i add TypeScript to an:
ASP.net
web-site
web-forms
Visual Studio 2012
solution?
Bonus Reading
Using TypeScript in an existing Visual Studio Web Site project (web-application)
How do I add typescript to an existing Asp.Net MVC project? (mvc web-application)
typescript for web forms (web-application)
Converting existing JavaScript code to TypeScript in Visual Studio (web-application)
You can simply add typescript files to the project and manage the compilation externally (outside of visual studio) using something like grunt-ts https://github.com/basarat/grunt-ts (disclaimer : I am one of the authors)
You can add a *.ts file to the web folder, then run the ts compiler from the command prompt.
Or create a separate web app with just the TS file. Then in the build properties, add a command to copy it to the desired location.

How to create a Web App project without page.designer.cs files?

In Visual Studio 2012 there is no website deployment, ok I switched to Web Project, now it has generated tons of page.designer.cs files, how can I make a web app project without the designer.cs files ?
Visual Studio create these files for easiness of coder, you will always get these kind of files when you create a new web app project. These files creates the necessary code you need for designing the web page.
But once you publish the web app to the server using the VS2010 publisher, these files are gone and only the .aspx files are remained. Why does this happen? because your code i.e. .cs files needs to compiled before it can be published on the server.

Windows Azure not generating aspx files

I setup my first Azure Cloude Service as well as Web Role. When I build and then publish application I can only see bin directory with all my dlls. I don't have any folders or aspx files.
\ProjectName.CloudService\bin\Debug\ProjectName.CloudService.csx\roles\Web\bin
How can I compile other files.
Are the .aspx files actually added to the Visual Studio project? (Visual Studio only copies the files it knows about.) If you don't see them in the treeview for the project, click the button at the top that shows files not part of the project, and then right-click and "include in project" on the files you're missing.
If that doesn't work, you might consider heading over to the MSDN forum for Windows Azure: http://social.msdn.microsoft.com/forums/en-us/windowsazure/threads and asking there.
If you look in your Cloud Service project folder, you won't find the aspx files, dlls, etc. The Cloud Service project folder will only contain your configuration files and eventually your packaged Azure deployment files. You'll want to look in bin\Debug\ folder under your Web Role (ASP.NET) project.

Resources