Instantly share code, notes, and snippets.

View gist:c031d463a846bebcef45a242fc5b59a5
"ServiceBusQueues": [
{
"Enabled": true,
"LogAPI": "http://localhost/IM-Test/LogAPI/",
"UseImConfig": false,
"ImConfigConnectionString": "Server=localhost;Database=IMConfig_Dev;Integrated Security=SSPI;Connection Timeout=60",
"ConnectionString": "Endpoint=sb://nodinite.comrvicebus.windows.net/;SharedAccessKeyName=pickupkey;SharedAccessKey=ib2+ofZaFyEhbwzgn1nAhw2XDY3UVc1JefdlGgLGIaa=",
"Queue": "pickup",
"ReplaceRules": []
}
View gist:e0250104f379bdc4ff29bbbec779687c
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;
using Newtonsoft.Json;
public static async Task<IActionResult> Run(HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
View Hyperlinks in markdown
View index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<title>Document</title>
<style>
View gist:066593af4161e3f7218dfca5085c7b72
using syron.ETagHelper;
using System.Net;
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
log.Info("C# HTTP trigger function processed a request.");
// parse query parameter
string name = req.GetQueryNameValuePairs()
.FirstOrDefault(q => string.Compare(q.Key, "name", true) == 0)
View gist:a7009128e44ca5f1f23eb89aa5395c38
{
"data": [
{
"_self": "http://myapiurl/data/3",
"id": 3,
"name": "Test3",
"description": "Hello MA"
},
{
"_self": "http://myapiurl/data/4",
View gist:2472245089d3f71692305364797c5291
{
"error": {
"code": 123,
"title": "login failed",
"message": "Lorem ipsum dolor sit amet..."
}
}
View gist:cc50fb6ba76cd831962955f27acf1a78
{
"data": {
"_self": "http://myapiurl/data/1",
"id": 1,
"name": "Test",
"description": "Hello World"
}
}
View Program.cs for debugging a windows service.
static void Main()
{
#if (!DEBUG)
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
#else
Service1 service = new Service1();
service.Init();
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
View Windows Service default Main method.
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new Service1() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}