Asynchronously streaming video with ASP.NET Web API
A lot of people think that ASP.NET Web API is basically a fancy framework for building APIs - which couldn’t be further from the truth. Web API is mainly about the new .NET HTTP programming model it brings to the table - embracing HTTP to perform a whole magnitude of web related tasks; and APIs are just a small portion of that. Hopefully if you follow this blog, you have seen examples of that already, as we often wander in the unkown areas of ASP.NET Web API, beyond building “traditional” APIs.
Today, let’s go back to the HTTP programming model and use Web API to asynchronously stream videos.
More after the jump.
Upcoming ASP.NET Web API events in Toronto
Running ASP.NET Web API with OWIN and Katana
One of the often repeated, and frankly, somewhat unfair, arguments against using .NET based technologies is that by doing so, you handcuff yourself to all kinds of various Microsoft tools and products.
If you choose to use ASP.NET Web API, by no means you are tied to IIS. Of course, one of the options is to self host it (and run the web service using the hardened WCF core), but if you want a true web host flexibility and independence, you can very easily host Web API using OWIN and Katana.
More after the jump.
Using existing database with Azure Mobile Services
One of the topics we like to come back to on this blog is Azure Mobile Services (ZUMO) - and rightfully so, because that’s a terrific service, capable of smoothly fueling your application’s backend in a hassle-free and scalable manner.
One thing you might have noticed about ZUMO though, is that pretty much all the online tutorials and materials related to it will show you how to work with it from scratch. One of the unknown facts about it, is that, with some slight modifications, you can actually plug in your existing SQL Server (or rather SQL Azure) database (provided you have earlier migrated it to Windows Azure of course), and serve it for your application utilizing the power of Azure Mobile Services.
Let’s a have a look at how you’d configure that.
Web API alternative – self hosting HTTP services in native C++ code
On this blog, I’ve been focusing pretty much exclusively on ASP.NET Web API, but today let’s step outside .NET, and explore how you could host RESTful HTTP services directly from the native unmanaged C++ code - and I hope, this is going to be a very interesting journey, especially as C++ is so much more efficient than any managed language.
If you haven’t done C++ before, or haven’t done any in years, don’t dread, modern C++ is quite different than what you might be used to of have heard of. Microsoft DevLabs and Niklas Gustafsson provide a terrific experimental library called [Casablanca][1], which is a C++ SDK aimed at creating modern HTTP services in native code.
More after the jump.
Extending Web API Help Page with information from attributes
Web API help page, available for your Web API via the Nuget package or built into the Web API template if you used the ASP.NET Fall Preview installer, is an extremely useful tool for documenting your API. That is, both for the external users that will consume the API, but also for your own development team, especially if the API is part of a larger internal ecosystem of applications and you need an automated, quick and easy reference for everyone to be able to look at.
Recently, I have been asked how you could automate the exposure of some additional information about the API, such as whether an action requires authorization or what are the potential response status codes.
And sure enough, it is very easy to do.
More after the jump.
Realtime ASP.NET Web API tracing with SignalR
The latest ASP.NET Fall Update, released recently, introduced the Web API tracing package into the Web API core. It is the default implementation of ITraceWriter, built around the System.Diagnostics, allowing you to easily trace what’s going on inside your API and output that into the debugger’s console.
On this very blog, we discussed a similar approach a couple of months ago already, by building an NLog powered trace writer for your Web API.
Today, let’s take all this a step further, and build something much more exciting - a realtime Web API trace, powered by SignalR.
ASP.NET Web API and dependencies in request scope
Regardless of what types of applications you are building with Web API, sooner or later you will run into a situation where you need to scope certain dependencies to the lifetime of a web request.
Examples of these types of in request scope dependencies could be loggers, unit of work implementations, NHibernate session, RavenDB session, Mindscape Lightspeed UnitOfWork or many other. Fortunately, this is very easy to do with Web API and an IoC container.
More after the jump.
Adding Session support to ASP.NET Web API
First the disclaimer. Yes, there are a lot of problems with using session in your ASP.NET applications. Moreover, by default, HTTP (and by extension, REST) is stateless - and as a result each HTTP request should carry enough information by itself for its recipient to process it to be in complete harmony with the stateless nature of HTTP.
So if you are designing a proper API, if you are a REST purist, or if you are Darrel Miller, you definitely do not want to continue reading this article. But if not, and you find yourself in a scenario requiring session - perhaps you are using Web API to facilitate your JS or MVC application, and you want to sync the state of Web API with the state of MVC easily, or you simply want a quick and easy way to persist state on the server side - this article is for you.
More after the jump.
ASP.NET Fall 2012 update (preview) is out – what’s new for Web API developers?
This evening, Microsoft has released a Fall 2012 Update to ASP.NET. The release brings a whole set of goodies for ASP.NET developers, including SignalR (now officially part of ASP.NET), C# FB app project template, Windows Azure Authentication and more. Jon Galloway has the updates very nicely summarized here.
Of course, as you’d expect, there are plenty of updates regarding Web API. Let’s have a look at them.
More after the jump.
About
Hi! I'm Filip W., a cloud architect from Zürich 🇨🇭. I like Toronto Maple Leafs 🇨🇦, Rancid and quantum computing. Oh, and I love the Lowlands 🏴.
Recent Posts
- 2024/11/22, Simplifying the AI workflow: Access different types of model deployments with Azure AI Inference
- 2024/11/15, Strathweb Phi Engine - now with Safe Tensors support
- 2024/10/25, How GPT-4o-mini can be simultaneously 20x cheaper and 2x more expensive than GPT-4o
- 2024/10/14, Speech-based retrieval augmented generation (RAG) with GPT-4o Realtime API
- 2024/09/06, Using Local Phi-3 Models in AutoGen with Strathweb Phi Engine
Categories
- ai (16)
- ai search (5)
- apache cordova (1)
- asp.net 5 (17)
- asp.net core (47)
- asp.net mvc (35)
- asp.net mvc 6 (7)
- asp.net vnext (6)
- asp.net web api (96)
- astronomy (1)
- autogen (1)
- azure (22)
- azure service bus (1)
- azure-devops (1)
- benchmark dotnet (1)
- bing maps (1)
- blazor (2)
- c plus (2)
- c-sharp (155)
- cryptography (5)
- csharp (5)
- csharp 10 (2)
- dnx (3)
- dotnet-cli (2)
- dotnet-script (11)
- duende (4)
- editorconfig (1)
- entity framework (2)
- espn api (2)
- events (1)
- ffi (4)
- fsharp (1)
- git (1)
- glimpse (1)
- html5 (4)
- identity server (2)
- iis (2)
- il (1)
- intro to qc (19)
- ios (5)
- javascript (9)
- jquery (4)
- jquery mobile metro (1)
- katana (2)
- kindle (1)
- knockout.js (8)
- kotlin (2)
- last.fm api (2)
- linq (1)
- mac (2)
- macos (1)
- mathematica (1)
- msbuild (3)
- mvc core (3)
- nancy (2)
- native (1)
- net (141)
- net 5 (3)
- net 6 (5)
- net 7 (7)
- net 8 (3)
- net 9 (1)
- net core (49)
- net sdk (2)
- ninject (2)
- odata (4)
- oidc (2)
- omnisharp (13)
- openai (11)
- osx (2)
- owin (5)
- phi (4)
- php (1)
- python (1)
- q-sharp (34)
- qir (3)
- quantum computing (38)
- roslyn (30)
- rust (5)
- scriptcs (11)
- scripting (9)
- security (8)
- servicestack (2)
- signalr (8)
- swift (8)
- testing (5)
- twitter boostrap (1)
- typescript (1)
- visual studio (4)
- visual studio code (11)
- wasi (3)
- wasm (3)
- windows phone 7 (1)
- wordpress (1)
- wpf (2)