Elmah for .NET Core - manually logging - asp.net-core

I've got an app that has elmah embedded in it for error logging. That app runs .net framework 4.x and uses a sql server backend. It is hosted up in azure.
I am porting the app the .net core and to connect to the same database. I've been googling, but can't find a way to manually enter an error into elmah under asp .net core. I need to store more information than just errors. I'm sure that the problem is with my searching on how to do this, so if someone could help a dumb soul and say how to do it, I would appreciate it.
TIA,
Wally

Have you tried HttpContext.RiseError(new InvalidOperationException("Test")); as mentioned in the https://github.com/ElmahCore/ElmahCore/#rise-exception ?

Related

error 500 on plesk(hosting) with my .net core webapi but work good in test (localhost) help me pleaaase

I have written an ASP.NET Core Web API, and published it on my plesk (hosting) web server, but it is not working - it is working in my test environment (localhost).
Important to know that my plesk (hosting) server use the version 4.8 of the .NET Framework and my API uses .NET Core 6; is that the reason it doesn't work? (I use the version 4.8 cause my web server host a website in webforms).
Here's the url to access the api on the web that throws an error 500 (any call return that)
https://apinhl.nhldynastypool.com/NHLAHLStatsAndSalaryInfo
In the screenshot below, I will post the file tree that I have in plesk (hosting) maybe it has something to do.
I have tried many thing but nothing seems to work I really need your help I do not have a clue what to do now it is the first time I try to deploy a web api and sorry for my bad English my main language is French :)
No cause i have to go to .net core 2.1 to work on .net framework 4.8 and all my code broke lol so i guess i have no other chpice to rewrote it in .net 4.8 framework in a webapp project

Using AspNetCore.SignalR with net462

Apologies if this is a stupid question, I've been looking into this for hours and have gotten myself really confused by the different framework versions and by the current state of SignalR.
I've got an asp.net core 1.1 web application (.NET Framework) currently targetting net462, and I wish to add websocket functionality to this using SignalR. I've tried adding the MyGet feed (https://dotnet.myget.org/F/aspnetcore-master/api/v3/index.json) but can't add Microsoft.AspNetCore.SignalR, even though this seems to be the recommended course of action. I wondered if this was because of an incompatibility between SignalR and net462, but SignalR targets netstandard1.3 which as far as I can tell should be compatible with net462.
Can anyone point me in the right direction?
I made two silly mistakes here, posting just in case it helps anyone else:
The correct feed url was: https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json
I didn't notice there was a 'Package source' dropdown

Trying to load opserver

I downloaded opserver that I saw at SQLPass. I can't seem to do anything with it. I tried opening it with VS 2008, VS 2010 and keep getting incompatible errors. What version of VS should I be using? I am a newbie so am in real unfamiliar territory. What do I do after I download it? Are there step by step instructions anywhere?
Opserver targets ASP.NET 4.5 for concurrency features, which I believe requires 2012 or better.
The official Opserver documentation assumes that you know how to build and publish and ASP.NET MVC 4 application. Typically the challenge in building MVC is getting the right dependencies/config setup on IIS the first time. Very easy to update after that. There are many blog posts and good answers on this site on that general subject.
If you want directions specific to Opserver, currently you are limited to third party blog posts such as the following:
Patrick Hyatt: Setting Up StackExchange's Opserver (very useful for the config files)
Danny Sorensen: Using Opserver Will It Build? (my own experience so far)
If this is not familiar territory, I recommend the following:
Use Visual Studio 2012 or 2013 on a machine with ASP.NET 4.5
Only enable the Opserver security file. Modify it for your IP address, or use "alladmin" to start.
Build it. If it doesn't work, use StackOverflow to solve your issue. You're having trouble with ASP.NET MVC 4, not Opserver at this point.
Now enable one additional config file at a time and build it again until you are done. Note, that you will not need to enable all of the config files unless your setup matches that of StackOverflow. Most of the config files are intended to be optional and left disabled.
You should be good with 2010, but you need to have ASP.NET MVC installed before opening the solution and building.

ASP.NET MVC 4 app gives 404, IController error on IIS 7.5/8

The last couple of days I've been trying to deploy MVC 4 applications to IIS 7.5 and 8 installations on Server 2008 R2 and 2012, but I'm basically getting the same error every time: 404 and "The controller for path '/' was not found or does not implement IController." On both servers I've made sure that .NET 4, 4.5 and the full MVC 4 stack are installed. The applications run fine on IIS Express in VS 2012.
Things I've tried and results:
Tried to deploy a clean MVC 3 applicaion: works;
Tried to deploy a clean MVC 4 application: doesn't work;
Tried to deploy a clean ASP.NET 4 WebForms application: works (which, I think, rules out the ASP.NET hosting capabilities being a problem);
Tried to deploy the MVC 4 apps with .NET 4 instead of 4.5: doesn't work (which, I think, rules out the .NET installations being the problem);
Tried to install hotfix 980368: installer says 'This update is not applicable to your computer', so that is probably already installed;
Made sure the app pool is on .NET 4.0;
Made sure all file permissions are setup properly;
Changed verbs on ExtensionlessUrlHandler-Integrated-4.0 to *;
Added the <modules runAllManagedModulesForAllRequests="true" /> tag.
But still no dice... I've read many SO questions and other websites which resemble the errors I'm getting, and I think I've tried all the tips I've read, but maybe I missed a crucial one.
Has anyone else experienced these problems, that can give me the fix I need?
Right, as it seems, adding the debug symbols (.pdb) to the bin folder makes the app start working again, even though it was deployed in Release mode. I'll do some research as to why this happens.
Edit: the answer can be found here: Removing .pdb from ASP.NET app on IIS breaks application

Issue Hosting Silverlight Application on IIS 7.5

I have an ASP.NET web application (.NET 4.0) that has a few pages, one page with a silverlight application in it.
When I debug locally, the silverlight app works fine. When I deploy to my web server (Windows Server 2008 R2, IIS 7.5), the silverlight app will not display.
I get an exception in Application_Error saying the following files are missing:
clientaccesspolicy.xml
crossdomain.xml
I have found a few things on the net that aren't very helpful - they say they need to be in C:\inetpub\wwwroot. I don't have a 'Default' website in IIS7.5 and I don't have these folders?
Where can I find them and where should I put them?
Please help, as this is very urgent. Many thanks.
EDIT: So I have tried doing what the link in my comment suggests. Some more info: I have a Silverlight-enabled WCF service that the Silverlight app uses in order to work.
Do I need to do anything special when deploying my app with an .svc file? I remember having to enable access to .svc files back in IIS5, but I don't know if that's necessary in IIS 7.5?
Hope this extra info helps. If you need any code snippets etc, let me know.
Thanks.
Well, worked it out - a slightly embarrassing and annoying problem..............
The service reference in the Silverlight application had a client address of 'http://localhost......', which was added by Visual Studio when I added the service reference.
I found a blog post by Tim Heuer describing the issue. I had to set the client address to a relative one, using '../Service.svc' in the ServiceReferences.ClientConfig.
Very annoying, sort that out please Microsoft!!!