Unable to generate Elmah.axd file of Elmah logging with Web API - asp.net-web-api

I have created Web API only. In that I want to use Elmah Logging. I have installed Nuget package of it. But when I try to access Elmah.axd file from browser it gives me an error : 404 Not Found. And that file is not generated. I have followed this link.
Do I need to do anything additional to generate/access this file?

I'm the author of the tutorial you have linked to. I just created a new Web API project and installed ELMAH. /elmah.axd is available. I would be very interested in seeing your web.config if you can update the question with that? Also, you can try to validate your web.config using the ELMAH Configuration Validator here: https://elmah.io/tools/configvalidator

Related

Unable to access web extension in Hybris

I have created my Web extension by extending ycommercewebservices extension but upon build I could not able to access any of the API from my custom extension(Error-404).
Entry in a extensioninfo.xml already available ::
<webmodule jspcompile="false" webroot="/myCustomExtension"/>
Also I could see my extension in Hac -> Extension but unable to access any of the API.
I have checked the logs and there is no any error as such w.r.t extensions.
Can someone please point out if I am missing anything.

Tool to validate a web.config

Is there a tool that I can use to validate my web.config? The reason I ask is that the file appears to be valid XML and IIS is complaining that file is invalid. No explanation or indication as to why.
Thanks in advance.
Edit:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x8007000d
Config Error
Config File \?\C:\DignityFiles\Source\simplicity\Simplicity\web.config
Requested URL http://simplicity-local.dignitytest.co.uk:80/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Config Source:
-1:
0:
More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
View more information ยป [This takes you to "https://support.microsoft.com/en-gb/help/942055/-http-error-500-19-error-when-you-open-an-iis-7-0-webpage"]
Link to the web.config (Note: sensitive information has been redacted)
I have (eventually) found the answer: https://stackoverflow.com/a/41267673
Installing the URL rewrite module fixed my issue.
This answer addressses the immediate concern, but if you are looking for a general solution in powershell I have created a function that addresses this.
The full answer is here: how do i validate an IIS web.config in powershell
But the gist of it is you have to find all the "filters" and test each of them individually via Get-WebConfiguration

Swashbuckle + XmlComments work locally, but fail swagger generation on server

I have a webapi project, and I am utilizing the swashbuckle framework to flush out api documentation.
I have followed the directions to build the documentation xml file with my controller and DTO's, and it all works great locally.
However, when generating the swagger document, a 500 error is thrown. I have confirmed if i remove my xml registration line, the swagger doc is generated and returned successfully.
here is my registration line:
GlobalConfiguration.Configuration.EnableSwagger(c =>
{
...
c.IncludeXmlComments($"{System.AppDomain.CurrentDomain.BaseDirectory}bin\\Company.MyApp.xml");
...
Update: I did some additional logging, and while this lne for IncludeXmlComments runs through successfully on startup, when I request the swagger.json file from the server, I am getting a System.IO.FileNotFoundException: Could not find file 'D:\home\site\wwwroot\bin\Monetary.Scheduling.xml' exception. when I use the Kudu tools to look into this directory, I cannot find this file.
TL;DR: Why is this file showing up fine locally, but when I deploy to Azure using Kudu or a Octopus nugget package, this file is not there?
The problem is that somehow the XML file is not making it to your server...
I had this exact issue with an Azure deployment it worked fine in my local machine but not in azure
...and it was because I was missing the XML doc in the release config

OWin Startup attribute not found error on Web API REST Request

I have a Web API project along with the built in help website. When I start up the project locally, the help website home page displays no problem. But when I send a REST POST request to an API controller using fiddler, I get the following response.
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- No assembly found containing a Startup or [AssemblyName].Startup class.
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of "false" in your web.config.
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.
I have tried to solve using the suggestions in the error message but no joy.
It works OK on the test server.
Can anyone suggest why this error is returned only on a REST request and not when the help website starts up and any tips on how to solve?

WebMatrix 2 site problems on upload to host

I have developed a Web Pages 2 website for my company using WebMatrix 2 that includes a simple SQL Compact Edition (.sdf file) database. Sounds simple. Runs perfectly on my local development box.
However, upon FTP to my Web host, it's a no-go. The first error I received was this:
Server Error in '/' Application.
Unable to find the requested .Net Framework Data Provider. It may not be installed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Source Error:
Line 1: #{
Line 2: WebSecurity.InitializeDatabaseConnection("Omniflow", "UserProfile", "UserId", "Email", true);
Line 3: }
I have searched and searched and searched the Internet, trying to find out what the source of this problem is and how to fix it. I haven't found the answer yet. I gather than apparently some needed assemblies/dlls are not being uploaded with the application. I have tried both FTP and the Web Deploy method with no fix.
Is this the root of the problem? And why does WebMatrix not upload all its dependencies? If it cannot, why is there nothing in the online literature from Microsoft--and it should come from Microsoft--or anyone else describing this issue?
Are you using one of the hosting sites listed on the Microsoft WebMatrix page: http://www.microsoft.com/web/webmatrix/ ? I know that when I deployed my WebMatrix site to a generic IIS server, it took some extra DLL's in the bin directory, and a couple of settings to be fine tuned before it worked.
While publishing check whether your have selected Database file( .sdf file ) or not.If not then select it and publish.
Hope it will work for you.
Ensure that you have all the SqlCE DLLs required for accessing the SqlCE database.
They should be present in the bin\, bin\x86\ and bin\AMD64\ folders.
You can try creating a new site using Site from Template -> Empty Site (ASP.NET) and checking the bin folder to see which all dlls are present.
If you don't already have them in your site, add them. That should solve your problem.

Resources