Swashbuckle + XmlComments work locally, but fail swagger generation on server - asp.net-web-api

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

Related

Spring Boot: Static content serving CSS correctly but not JS

We're trying to serve a React app via Spring Boot.
Spring is able to serve the CSS folder's css files (src/main/resources/static/css/), but is not able to serve the JS folder's files (src/main/resources/static/js/). There is a main.8f965741.chunk.js inside the JS folder, and when we run the application, it is returning an error 404.
It is not a browser/caching issue.
It is not a folder/file permissions issue.
Any thoughts on how to debug this? Spring gives us essentially no output for the 404.
You can turn on DEBUG (or TRACE) level logs by adding the following to your application.properties:
logging.level.org.springframework.web: TRACE
Then try requesting the JS file directly, perhaps with curl (e.g., curl http://localhost:8080/js/main.8f965741.chunk.js)
The logs should tell you how the request was mapped and how it was subsequently handled. You can compare the logs generated here with a "known good" request (perhaps from requesting a css file).
If you've built a .jar or .war artifact, you can also unpack it (using jar xf ...) and double check if the js files are properly packaged there.

Unable to generate Elmah.axd file of Elmah logging with 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

WCF not working when debugging in visual studio but works in IE

I have a WCF that is hosted in an ASP.NET application. Suddenly, the WCF service has stopped working when i debug it in visual studio 2010. When i try to access the service, it throws the below exception.
CommunicationException was unhandled by user code. The remote server returned an error: NotFound
I have WCF tracing enabled but no errors are being logged.
The strange bit is that if i deploy the code to my QA server and access the application, the service works fine, so the code looks like not the problem.
If i also get the source code currently running in production successfully & try debugging it in my dev environment, it fails with the same error i mention above.
Any one have an idea what could be messed up in my dev environment?. I have tried both IE, Firefox & Chrome & the results are the same.
I after a very long debugging involving deleting Bin & obj folders and lots of rebuilds, i finally got this WCF service working again.
First, i suspected the service could be corrupted somehow, so i tried to update the service reference in my silverlight application but was bumped with the following error.
There was an error downloading 'http://localhost/mySite/Webservice/GetData.svc'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 'http://localhost/mySite/Webservice/GetData.svc'.
The remote server returned an unexpected response: (405) Method Not Allowed.
The remote server returned an error: (405) Method Not Allowed.
I then browsed to the physical folder path to confirm if really my .svc file was there and indeed as expected, the file was there.
Trying to Browse to the path http://localhost/mySite/Webservice/GetData.svc in my browser bumped me with another error below.
HTTP Error 404.7 - Not Found The request filtering module is
configured to deny the file extension.
Most likely causes: Request filtering is configured for the Web server
and the file extension for this request is explicitly denied.
This made me start thinking that suddenly, IIS 7.0 has decided to block access to my .svc files.
I then added fileExtension=".svc" mimeType="application/octet-stream" to IIS, restart IIS but got the same error.
I then read on some blog i cant remember about adding <add fileExtension=".svc" allowed="true" /> under <requestFiltering> tag in file applicationHost.config located at C:\Windows\System32\inetsrv\Config, still nothing changed. Tried adding <mimeMap fileExtension=".svc" mimeType="application/octet-stream" /> under serverSideInclude in the same file, again with no luck.
Tried this http://www.adamwlewis.com/articles/iis-7-not-serving-files-4047-error still with no luck.
The following 2 steps are i think what resolved the issue.
I added a mapping for the SVC extension to ASP.NET by running ServiceModelReg.exe -i from C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation
Browsed to my .svc file in the browser and this time it looked like i had made some progress but still, i had one more error to overcome . The is bellow.
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
I resolved the above error by registering the correct version of ASP.NET using the ASP.NET IIS Registration Tool (aspnet_regiis.exe,) as described in the link below
https://msdn.microsoft.com/en-us/library/hh169179(v=nav.70).aspx
At this point my service was back to normal as it had always been. I still haven't figured out what messed up my development machine.

DataTorrent - Developing Hello World Application

I am totally new to DataTorrent. I am trying to build a sample application using data torrent using this link but information given on this page is not much helpfull. I created a maven project as described on page using below command.
mvn archetype:generate -DarchetypeRepository=https://www.datatorrent.com/maven/content/repositories/releases -DarchetypeGroupId=com.datatorrent -DarchetypeArtifactId=apex-app-archetype -DarchetypeVersion=3.0.0 -DgroupId=com.td.example -Dpackage=com.td.example.shashi -DartifactId=shashi-app -Dversion=1.0-SNAPSHOT
Project was created successfully but after that it says to create a zip file for uploading on application server.
I ran below command to upload it but it is giving problem accessing server.
curl -XPOST -T shashi-app.zip http://hostname:9090/ws/v2/appPackages
Any pointer on above issue?
The application can be submitted via gateway using REST calls.
To do that, the apa file needs to be uploaded into the appPackages - you can do this from DT UI console or by using a REST call to POST the jar.
Please check for your syntax of the job submission. The following link has the documentation on uploading the job and submission using REST calls.
http://docs.datatorrent.com/configuration_packages/#post-wsv2apppackagesuserapp-pkg-nameapp-pkg-versionapplicationsapp-namelaunchconfigpackageuserconfpkgname

Getting a 404 using App Harbor and BitBucket

I'm new to AppHarbour and I'm trying to deploy my MVC app on a free account.
I keep getting a 404 error.
The app is coming from Bit-bucket and it was deployed successfully.
In my Hostnames section i see the following
so i have added the following to the Hosts file in my machine:
176.34.122.158 camelotfaultmanagement.apphb.com
but i still get a 404 ..
What am i doing wrong ?
And a follow-up question how can i edit one of the files to be able to edit the connection ?string to my DB?
It looks like you may not have any successful builds yet - You have to push to Bitbucket to trigger your first build. You can see a list of builds on the app dashboard: https://appharbor.com/applications/camelotfaultmanagement
To use the built-in .apphb.com domain, you don't have to mess with any DNS setup.

Resources