Last 50 Comments

re: Checking out the Helios IIS Owin Web Server Host
Friday @ 5:06pm | by Rick Strahl

@Enrico - I suspect the new versions of Helios will add new features so it's likely that they'll end up adding a little overhead. OTOH, the code will also be optimized before it's made live, so I'd think in the end the numbers will look probably very close.

As to the load factor - yes, you probably have to play with what's optimal. On my machine adding additional concurrent requests only ended up slowing down the response volume, not increase it, but I suspect this has more to do with Windows 8 IIS throttling than limits anything in the actual request handlers since they all show roughly the same drop off.

As suggested by others your mileage will vary based on the hardware you're running, whether you test locally or remotely, or whether you're running on a client or server version of Windows to do the load test.
re: Checking out the Helios IIS Owin Web Server Host
Friday @ 12:58am | by Enrico

Hi,
I re made the whole tests with the new version of Helios and in fact some slowdown happened (see https://github.com/endaroza/AspNetFrameworksPerformance/blob/master/20140418.LoadTests.png) Plus, i made some modification because my test machine was using , separator for decimal instead of ..
One side note. To reach the results you showed i had to setup a load factor of 1000 (-c1000) on ab, instead of the 20 that is used on the github project. It would be ok?
Plus... i developed a MVC/WebApi server with coroutines and without tasks that i tested too and seems reaching a good speed.
Thank for your "integrated test bench" :)
Enrico
re: Forms Auth loginUrl not working after Windows Update?
Thursday @ 6:35pm | by Vinny Brown

Seems like it really is necessary to turn off automatic updates and test every update that comes along. Sounds like yours was a smaller and older app, but it really gets me thinking about mine. Thanks for the blog post.
re: Visual Studio 2013 'Could not evaluate Expression' Debugger Abnormality
Thursday @ 11:04am | by Maria Ghiondea - MSFT

The link to the CTP2 has expired because the RC is now available: http://www.microsoft.com/en-us/download/details.aspx?id=42307

Thanks,
Maria Ghiondea
Visual Studio Debugger
re: Accepting Raw Request Body Content with ASP.NET Web API
Thursday @ 9:06am | by Mick

I change this code to put more parameters.

In NakedBodyParameterBinding in ExecuteBindingAsync

I change:
if (binding.ParameterBindings.Length > 1 ||
actionContext.Request.Method == HttpMethod.Get)
return EmptyTask.Start();

var type = binding
.ParameterBindings[0]
.Descriptor.ParameterType;


To

if (binding.ParameterBindings.Length == 0 ||
actionContext.Request.Method == HttpMethod.Get)
return EmptyTask.Start();

var parameter = binding.ParameterBindings.FirstOrDefault(x => x.Descriptor.ParameterBinderAttribute !=null && x.Descriptor.ParameterBinderAttribute.GetType() == typeof(NakedBodyAttribute));
if(parameter ==null)
return EmptyTask.Start();
var type = parameter.Descriptor.ParameterType;
re: Accepting Raw Request Body Content with ASP.NET Web API
Thursday @ 8:43am | by Mick

If they are more than 1 parameter. It's don't work.
re: ASP.NET Web API and Simple Value Parameters from POSTed data
Wednesday @ 4:24pm | by Rick Strahl

@Scott - there are some workarounds:

http://weblog.west-wind.com/posts/2012/May/08/Passing-multiple-POST-parameters-to-Web-API-Controller-Methods

http://weblog.west-wind.com/posts/2012/Sep/11/Passing-multiple-simple-POST-Values-to-ASPNET-Web-API

but as you've found out, it's not exactly obvious or easy to work around.

Overall I'd say the best way to handle this is to use ViewModels to represent the data you're trying to capture - it's the most efficient and 'WebAPI' way of doing things. If you really need to map POST values to parameters and you prefer that style, then using the Parameter binder in the second post is the way to go.
re: ASP.NET Web API and Simple Value Parameters from POSTed data
Wednesday @ 2:05pm | by Scott Gartner

Thanks for this, I spent a bunch of time trying to get POST data to map to a simple f(string,string) before I found your article and now know that it just won't work!
re: Updated ASP.NET Database Resource Provider
Tuesday @ 8:58am | by Rick Strahl

@Bill - The Resource handler works with either the DbResource or Resx providers. There's a flag (on the helper method or the actual URL sent to retrieve the resources) that can be set to determine how the resources are retrieved and served.
re: Custom Localization ResourceProviders and Compiler Errors
Tuesday @ 7:10am | by Rick Strahl

I recommend you look at the updated version of this provider at:

http://west-wind.com/Westwind.Globalization/

Much improved and less configuration you have to deal with - same tool, just a newer version and easier integration.
re: A Localization Handler to serve ASP.NET Resources to JavaScript
Tuesday @ 7:03am | by Coseta

Hi, Rick! If you're involved in software localization projects, you should consider checking out this online localization tool: https://poeditor.com/
It’s a very intuitive online translation platform; it is perfect for collaborative translation and has great crowdsourcing potential.
Cheers and good luck with your projects!
re: Custom Localization ResourceProviders and Compiler Errors
Tuesday @ 12:46am | by Paresh

Hi,
I am trying sample code available at http://www.west-wind.com/WestwindWebToolkit/Westwind.GlobalizationWeb/default.aspx
When i implement same in my web site, it gives "object reference not set to an instance of an object" at the time of compilation.
If i host sample code in IIS, it also start giving same error.

Can anyone please suggest solution for it?
Thanks,
re: Updated ASP.NET Database Resource Provider
April 14, 2014 @ 10:31pm | by Billl Yoergensen

Does the JavaScript resource handler work without having to use the database provider? This looks really useful, but we have to use Resx resources and it would be nice to serve our server resources to JavaScript.
re: Updated ASP.NET Database Resource Provider
April 14, 2014 @ 9:47pm | by Rick Strahl

@James - thanks for the kind words.

Re: Resource Editor - yes I know. The code base is pretty old. I cleaned it up a bit recently for better standalone operation and as a drop in for existing projects when I created the NuGet package. It works and is functional but it could definitely be done better, I agree. I've started a re-write a couple of weeks back on a local branch here - removing much of the WebForms related stuff reducing one of the dependencies and greatly cleaning up the WebForms based HTML to just plain HTML. But it'll take some time to hook up all the functionality again so it might take a bit. But it's coming...
re: Updated ASP.NET Database Resource Provider
April 14, 2014 @ 9:43pm | by James Mallard

Nice work Rick! We're just starting to add localization to an existing app and this looks like it will make life a lot easier.

FWIW, the resource editor is a great idea, but it could need a little polishing. There are a few things that feel inconsistent - I think I might take a stab at cleaning those up on a fork.

Keep up the good work, man and thanks for making this available.
re: The Search Engine Developer
April 14, 2014 @ 5:38am | by Robin

I think what is being debated here is actually knowledge (ie facts and figures) vs understanding. If you have knowledge without understanding you will get nowhere. What the internet has achieved is the "outsourcing" of knowledge. You do not need to know everything anymore, as long as you can figure things out. In fact it would a little silly to try to memorize what Google can give you in a second or two. But if you don't understand the code snippet you are looking at you cannot even begin to evaluate whether it can be of use to you or not.

In some countries, especially at University level, you are allowed to bring all the books and calculators you want into your exams. Why? Because the exams test your understanding of the problem, not your knowledge. No book or website is going to help you figure out the solution to the problem posed in the time allowed, unless you already have the necessary understanding.
re: Dell XPS 15 review
April 13, 2014 @ 7:47pm | by Rick Strahl

@Danzo - not sure if the 91whr battery takes up more space - I think the chassis and layout is completely fix for this machine, since they won't let you customize anything. But you'd have to check.

I've been getting about 5 hours out of the 61whr battery doing dev work, in balanced mode which is pretty good. My last laptop managed 3.5hours at most. I gave up trying to have lots of battery time any more as I'm either wired at home or in transit while travelling - I don't use my computer on planes any more - there's simplt not enough room on a plane anymore to be productive :-) So to me the battery life is not that important - less weight is a nice thing too :-)

FWIW, I did install of USB eventually - it was just finding the right version to install Pro from to match the MSDN key that was a bitch.

It's now been almost a half a year and the machine has been a joy to use. The only thing I don't like is the extended (Home/End) key layout that requires the FN key to work. That's a pain to get used to. Other than that it's been nothing but WIN.
re: Dell XPS 15 review
April 12, 2014 @ 12:49pm | by Danzo

Great Review. But you didn't elaborate on the battery. Can you tell me how long the 61 Whr 6 cell battery lasts?
Heard the 91 Whr battery is bigger and therefore takes up the 2.5" sata disk space, is that true?

Btw you should've tried a UEFI USB Flash of Windows 8.1 to reinstall the OS: The Option 1.

http://www.eightforums.com/tutorials/15458-uefi-bootable-usb-flash-drive-create-windows.html
re: Evaluating JavaScript code from C#
April 11, 2014 @ 10:41am | by Richard Ernst

I used the approach mentioned above by "Joe" in his post on March 5, 2007 @ 4:50pm. I am using Visual Studio 2013/.Net 4.0, so I used the .Net 4.0 version of jsc.exe.

It works perfectly for me, and performs roughly 25% faster than the approach referenced by "Lea Hayes" on October 01, 2008 @ 9:32am (http://www.odetocode.com/Code/80.aspx).
re: Updated ASP.NET Database Resource Provider
April 10, 2014 @ 9:52pm | by Bill Poiter

Rick - this looks really promising. We've built our own implementation that's somewhat similar but we didn't take the time to put in all the embellishments that I see in this library. The Resource Editor and Resource Handler to serve JavaScript resources are things we didn't even consider. Will be checking this out in the next couple of days. Cheers.
re: Using JSON.NET for dynamic JSON parsing
April 10, 2014 @ 3:15am | by KCS

I cannot get the dynamic methodology to work with Silverlight (5).

// strong typed instance
var jsonObject = new JObject();

// cast to dynamic to dynamically add/read properties
dynamic album = jsonObject;

album.AlbumName = "Dirty Deeds Done Dirt Cheap"; // WORKS

album.Songs = new JArray() as dynamic; // FAILS
re: Getting a 'base' Domain from a Domain
April 10, 2014 @ 12:03am | by steve

you can get domain name like the following:

Uri myUri = new Uri("http://forums.asp.net/t/1110512.aspx?");
string host = myUri.Host;

more methods to get domain name...

http://net-informations.com/faq/asp/domain.htm

steve
re: Accepting Raw Request Body Content with ASP.NET Web API
April 07, 2014 @ 8:43pm | by Rick Strahl

@Tim - That makes no sense to me. If you want the raw body why would you want to validate the JSON? You get a string or raw buffer because that's what you're asking for with 'raw' data. If you want validation for your JSON match it to an object or use dynamic and get back a JsonValue object you can iterate through without typing.
re: Updated ASP.NET Database Resource Provider
April 07, 2014 @ 8:40pm | by Doug Dodge

Rick,

This is pure gold. I don't have time to fool around with it but have forwarded a link to a local fellow who's big into internationalization by the name of Adam Wooten. Hopefully this will drive some work and traffic your way.

re: Dell XPS 15 review
April 07, 2014 @ 8:40pm | by Rick Strahl

@joan - sure used winmerge. BeyondCompare is just a way better UI IMHO. Well worth the $50 for the Pro edition.
re: Dell XPS 15 review
April 07, 2014 @ 12:21pm | by Joan Pons

Hi Rick, really nice post!
regarding beyondcompare, have you tried http://winmerge.org ?
hope that helps!
re: Accepting Raw Request Body Content with ASP.NET Web API
April 07, 2014 @ 10:03am | by Tim Hardy

The following...
[HttpPost]
public string PostJsonString([FromBody] string text)


does NOT work with property formatted json...
{ "name": "widget", "description":"some description" }

It always returns null for text, and it's very frustrating. That's with Content-Type: application/json; While "Posting a JSON string" might be a valid json request, I've never seen one that's a simple string. Practical json requests, anything starting with a curly brace, don't work.

It works if you put an = in front of the first curly brace, but I'm not going to change the client code to hack that in. The only way I can get dynamic json to be accepted in a web api controller is to accept it as a JObject, and incur a couple of extra transformations that I'd rather avoid.

I'll try your NakedBody attribute, but I'd like something that at least validates the body is valid json. It's crazy to me that this isn't possible in Web Api out of the box.
re: ASP.NET Frameworks and Raw Throughput Performance
April 06, 2014 @ 6:39pm | by Dmitriy@itadapter

Rick, you forgot the "-k" keep-alive switch.
Interestingly, I get 9,800 req/sec between my laptop and server under the desk, but as soon as I stick "-k" I get 85,000 req/sec.

ab -n100000 -c36 -k "http://127.0.0.1:8080/embed/count?from=1&to=1"

I run HttpListener-based server (no IIS) and completely bypass MS web stack, but that is besides the point
re: Using JSON.NET for dynamic JSON parsing
April 05, 2014 @ 12:06pm | by Rick Strahl

For all intents and purposes, JSON.NET is now a .NET component especially for Web apps. On the Web Stack JSON.NET is a standard added component for any MVC/Web API project, so it's typically available. You need to use some JSON library and JSON.NET certainly is a better choice than any of the native .NET solutions by far, especially for dynamic JSON parsing which isn't supported in any of the native .NET JSON parsers. Microsoft has just about abandanoned the native JSON parses anyway.

With NuGet having an external dependency is much less of an issue these days as you can easily tie dependencies together in source code projects. For compiled project - yes you may have to ship another assembly, but chances are it's already there.
re: Using JSON.NET for dynamic JSON parsing
April 05, 2014 @ 5:58am | by Ajmal

I am writing a C# wrapper for a RESTful JSON API, and using Json.NET to de-serialize the incoming json to strongly typed object. but a few properties in the incoming json are highly dynamic, it will be some json object with different number and type of properties. My current solution is, I mapped the dynamic json property to JObject in my C# class. Is this a good practice use this, considering JObject depend on a third party library (Anyway Json.NET is a dependency for my library because I am using it for json serialization) . Please advice.
re: Using plUpload to upload Files with ASP.NET
April 05, 2014 @ 5:21am | by lyh

awesome
re: Visual Studio 2013 'Could not evaluate Expression' Debugger Abnormality
April 04, 2014 @ 7:42am | by Rob

Andrew -

Typical Microsoft link you provided above -- already expired :(
re: UNC Drive Mapping Failures: Network name cannot be found
April 04, 2014 @ 5:51am | by bobski

You are a god!

Thank you!
re: Using plUpload to upload Files with ASP.NET
April 02, 2014 @ 10:59pm | by MihaiB

Indeed it's working.

Thanks Rick
re: JavaScript JSON Date Parsing and real Dates
April 02, 2014 @ 11:32am | by David Robbins

Very nice!!! Dates and javascript are the ugly elephants in the room, especially if you end create a client solution for project management apps, with Gantt charts, timelines, etc. I'm so used to sighing in discouragement it makes me numb.

Looking to trying your solution out. Thanks Rick.
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
April 01, 2014 @ 2:16pm | by Alex

I was using a "self-pinger" service based on your other blog-post - http://weblog.west-wind.com/posts/2007/May/10/Forcing-an-ASPNET-Application-to-stay-alive but guess no need for that now... Will try to move things to the App Initialization module. Great stuff, thanks Rick (again!)
re: Auto Selecting Cultures for Localization in ASP.NET
March 31, 2014 @ 7:18pm | by Richard

Rick - Thanks so much for this. It's crazy elegant. I'm currently using a crazy #DEBUG-IF block to do this check based on "Release" vs "Debug" building. I love this idea.
re: Visual Studio 2013 'Could not evaluate Expression' Debugger Abnormality
March 31, 2014 @ 9:59am | by Andrew Hall

Regarding the bug with "Could not evaluate expression" bug; the fix for this was first included in Visual Studio 2013 Update 2 CTP 2 (http://www.microsoft.com/en-us/download/details.aspx?id=42023). Please try installing that. If that does not fix the issue, please let us know using the Visual Studio 2013 Feedback Tool (http://visualstudiogallery.msdn.microsoft.com/563d1003-f0ed-498f-8ef9-f8ee1aac39fe)

Thank you,
Andrew Hall
Visual Studio Debugger
re: Updated Westwind.Globalization Data Driven Resource Provider for ASP.NET
March 31, 2014 @ 8:45am | by Orry Rotem

Luis, it did help!! :) Thanks for posting the configuration change.
re: Auto Selecting Cultures for Localization in ASP.NET
March 31, 2014 @ 2:28am | by Rick Strahl

@Richard - re:RequireSslBasedOnConfigSetting attribute. It's pretty simple - subclass RequireHttpsAttribute and override the OnAuthorize method so you check some config setting (in our case from the config file using my AppConfiguration class)...

public class RequireSslBasedOnConfigSettingAttribute : RequireHttpsAttribute
{
    public bool RequireSsl { get; set; }
        
    public RequireSslBasedOnConfigSettingAttribute()
    {
        RequireSsl = App.AdminConfiguration.RequireSsl;
    }
    public RequireSslBasedOnConfigSettingAttribute(bool requireSsl)
    {
        RequireSsl = requireSsl;            
    }
 
    public override void OnAuthorization(AuthorizationContext filterContext)
    {
        if (filterContext != null && 
            RequireSsl && 
            !filterContext.HttpContext.Request.IsSecureConnection)
        {
            HandleNonHttpsRequest(filterContext);
        }
    }

re: Auto Selecting Cultures for Localization in ASP.NET
March 30, 2014 @ 6:07pm | by Richard

Thanks for the article, Rick. Localization is the thing that is killing us the most in our current application being written.

However, I was actually wondering if you have the code snippet (or another blog posting) behind the "RequireSslBasedOnConfigSetting()" decorator on your controller in the MVC example.
re: Use IIS Application Initialization for keeping ASP.NET Apps alive
March 30, 2014 @ 4:56pm | by Mark Aurit

Thanks for the excellent documentation. Were you a tech writer in another life .5 :-)
re: Creating a C#/.NET CGI Executable
March 28, 2014 @ 12:43pm | by Aleksey

When I try to call "Environment.GetEnvironmentVariable("REQUEST_METHOD")", I reciev an error "Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed." What I have to do? Trust level in web.config is "Full".
re: Process.Start() and ShellExecute() fails with URLs on Windows 8
March 28, 2014 @ 6:47am | by Tebogo Letlalo

Just do the following and your problem should be solved.
I had the same problem doing a demo from the customers pc :-(


var videoLink = "http://microsoft.com;
Process.Start(new ProcessStartInfo("explorer.exe", "\"" + @""+videoLink + "\""));
re: WebAPI: Getting Headers, QueryString and Cookie Values
March 27, 2014 @ 4:33pm | by Rick Strahl

@Thiru - that only works hosted inside of ASP.NET. If you self-host, there's no HttpContext and your code will break.
re: Hosting SignalR under SSL/https
March 27, 2014 @ 4:31pm | by Rick Strahl

Irpham - yes you can - just run WebApp.Start() multiple times for each of the URLs involved. This creates separate service hosts, but they all use the same static SignalR components.
re: Hosting SignalR under SSL/https
March 27, 2014 @ 2:08pm | by lrpham

Thanks for the great writeup. Following the directions, I was able to get SignalR to work under HTTPS. Is it possible to have SignalR handle both HTTPS and HTTP under the same service, under the startup factory invocation ? Thanks.
re: Visual Studio 2013 'Could not evaluate Expression' Debugger Abnormality
March 26, 2014 @ 10:50pm | by Claudio

It simply works like that!

Thanks a Lot!
re: WebAPI: Getting Headers, QueryString and Cookie Values
March 26, 2014 @ 10:25am | by Thiru

can it be any issue if we use HttpContext.Current.Request.QueryString["val1"]
re: Digitally Signing an XML Document and Verifying the Signature
March 25, 2014 @ 9:38am | by Javier

How to add a SignatureTokenReferenceTag, i am trying consume a Java Web Service (wss4j).??


Thanks


West Wind  © Rick Strahl, West Wind Technologies, 2005 - 2014