I'm using vsperfmon to collect code coverage inforation for an asp.net mvc website. My ultimate goal is to collect code coverage data while I'm running browser automation tests against the website. Here is what I'm doing right now
Use vsinstr.exe to instrument the DLL of the asp.net mvc website
vsinstr.exe /coverage
Start perfmon in coverage mode
vsperfmon /start:coverage /output:c:\result.coverage /user:
Here for username I have tried "Network Service", "Everyone" and the user configured for the app pool of my website. I have also tried cross session option.
Browse the website for few minutes
Shutdown the perfmon
vsperfcmd /shutdown
I have also tried shutting down iis before running step 4
After this, when I look at results.coverage in visual studio, it says coverage file is empty.
I'm following this video - http://www.asp.net/visual-studio-team-system/videos/how-do-i-enable-code-coverage-and-profiling-in-production-applications
Am I missing something here
Related
I have an executable file which I would like to run alongside a .NET Core web application. It needs to start when the web application loads and will continuously run until the web application ends. I also need to be able to check if the executable file is still running through the UI, and have an option to start, stop or restart.
I have done a bit of googling already on this and all that keeps returning is examples where the exe file is expected to end at some point, not anything that continuously runs.
Any pointers in the right direction would be great.
Andy's comment is correct. It's recommended to using Background tasks with hosted services in ASP.NET Core.
And you also can use signalr to record the status of your service. You can start, stop by using StartAsync and StopAsync. And it's impossible to restart. The background service was launched with asp.net core.
For more details, you can check the blog:
Communicate the status of a background job with SignalR
I am trying to deploy an ASP.NET MVC5 web app (web deploy deployment package) on my Windows Server using Command Prompt as I have done countless of times before with the same web app. When I try running the command
myproject.deploy.cmd /t
inside the correct folder the process starts but then abruptly stops and the CLI window closes.
Just before the window disappears I can see an error message in red, but I just do not have enough time to read what it says.
My question is where does one find the logs for commands that have failed? Alternatively is there a way to force the CLI to stay open in order to read the error displayed?
I managed to find the logs in the Event Viewer:
Event Viewer -> Applications and Services -> Microsoft -> Windows -> WebDeploy -> Errors
I am Building web application on asp.net core.
my application needs some data once in a week.
I have created console application which gets this data (really, it parses some website once in a week and stores that data in a database).
I have configuration file when should that console application start to get that data.
My question is how to start that console application from my web app and is it a good idea to start console application from web application?
IMHO it's not best practice to start a console application from an web application. If you would like to do that, please consider using a Windows Service with an timer or a cron job for that.
What you can do is create a scheduled tasks using Windows Task Scheduler. This task's action will be to State a Program and then you can set Program/Script to your console exe file. You can schedule this task to run once a week.
You can check this task history to ensure the task is executing weekly and can run it manually in case of failure.
Is this possible to put WCF in webjob that will return list of records to webapp.Actually I have project that returns search results (searching is done via lucene.net). Is there any guide or way to get results in my webapp from webjob?
Also can anyone guide me on my localhost I am running my webapp and web job is part of same solution. When I run web application, main function of WebJob is not hitting. Web app and web job can run simultaneously? If these are not runs simultaneously then How can I invoke my searching project initially ? How can my web project relate with my web jobs? I know about invoking by queue but some functions should be run initially when web application is started.
I want to test this behavior on my localhost
Is this possible to put WCF in webjob that will return list of records to webapp.Actually I have project that returns search results (searching is done via lucene.net). Is there any guide or way to get results in my webapp from webjob?
As I known, Azure WebJobs provide you with an easy way to run scripts or programs as background process in the context of your Azure Web Apps. You could not get results directly from WebJobs in your Web Application, you need to store your results in a central data center (Azure Queue, Table Storage,Service Bus,etc.), then you need to retrieve the data explicitly in your Web App. Here is a official tutorial about web application working with Azure WebJob.
Also can anyone guide me on my localhost I am running my webapp and web job is part of same solution. When I run web application, main function of WebJob is not hitting. Web app and web job can run simultaneously?
You could right click your solution and select Properties, choose Startup Project under Common Properties, choose Multiple startup projects and configure the Action for your web application and your WebJob. For more details, you could refer to this issue.
UPDATE:
sorry if this is a stupid question but I don't get it.
So I've created an ASP.NET 5 page using Visual Studio 2015 and DNX.
Out of the box I have these two dependencies in my project.json:
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4"
Under "commands" in project.json I have the following:
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
In the project properties I can change profiles between "IIS Express" and "web" as deployment options. Both are working fine, when I start debug it starts the web server (either IIS Express or the WebListener) and the site is working. If I stop debugging the server stops. The WebListener opens a "dnx.exe" in a command prompt.
This pluggable server layer is really nice, I get the point. But how do I, as a developer setup an easy server where I can make a change to my site and quickly see the changes?
I can of course install IIS and create a site that is pointing to my wwwroot but is that my only option in the ASP.NET world? Can I have the WebListener "started in the background" (without showing me a command prompt with dnx.exe)? I can also start a node server but yet again - it's great that i can but why do I have to when I have the full ASP.NET toolbelt?
ASP.NET 5 has dynamic compilation but I'm not sure how to even test it since my web server is only started when I'm in debug mode.
I know that this is a pre-release but any help would be greatly appreciated.
But how do I, as a developer setup an easy server where I can make a
change to my site and quickly see the changes.
Regardless of the server used, you can use dynamic compilation by Starting the project without debugging (Shift + F5).
Due to architectural reasons, dynamic compilation does not work when starting with debugging (F5) in Visual Studio. This is due the fact that the difference between Shift + F5 and F5 is that in the latter, VS attaches the debugger to the process.
Will this every be supported in the future? That is unclear but right now because VS isn't "smart" enough to handle detaching from process, waiting for dnx to dynamically recompile, and then reattaching to the process. However until now it never had a reason to support such a scenario, so it is unclear if it is just a "it doesn't know how to do it yet" or a "it is impossible to do."
I can of course install IIS and create a site that is pointing to my
wwwroot but is that my only option in the ASP.NET world?
No. You can use any webserver which supports Microsoft.AspNet.Hosting. Today your choices are limited to IIS, IIS Express, and the two experimental servers you linked to but the goal is to enable third parties to develop alternatives by providing an interface that can be programmed against (Microsoft.AspNet.Hosting).
ASP.NET 5 has dynamic compilation but I'm not sure how to even test it
since my web server is only started when I'm in debug mode.
If the web application is running then the server is started. No webserver = no ASP.NET application. I assume by "debug mode" you mean "Start with Debug (F5)". If so then "Start without Debug (Shift + F5)" to fix the problem you're experiencing.
Here is an excercise:
Close Visual Studio (not a requirement but useful to show none of this is VS specific).
Start the web server. The easiest way would be dnx . web run from command line in the project root folder. You could however start IIS Express (should already be configured) or even configure the IIS and start it.
Verify the web server and web application is running by opening it in a browser.
Using notepad or some other text editor, edit a file in the project that would have a visible change or just force an error "throw new NullReferenceException()".
Save the file.
Refresh the browser.
The web application will reflect the change. You may notice a slight delay if you refresh quickly. That is the dynamic compilation to memory occurring.