What’s new in WCF 4.5? Changed default for ASP.NET compatibility mode

October 31, 2011

This is the eighth post in the WCF 4.5 series. This post continues the previous posts on web-hosting features. This post is about the ASP.NET compatibility mode default change of WCF 4.5.


Previous posts:


1. What’s new in WCF 4.5? let’s start with WCF configuration


2. What’s new in WCF 4.5? a single WSDL file


3. What’s new in WCF 4.5? Configuration tooltips and intellisense in config files


4. What’s new in WCF 4.5? Configuration validations


5. What’s new in WCF 4.5? Multiple authentication support on a single endpoint in IIS


6. What’s new in WCF 4.5? Automatic HTTPS endpoint for IIS


7. What’s new in WCF 4.5? BasicHttpsBinding


Normally, a WCF service hosted under IIS works side-by-side with ASP.NET – they share some of the pipeline, they have the same application domain, but work quite independently of each other when it comes to the HTTP context (authorization, context, session, etc…). This is the default behavior of WCF.


However, you can change the default behavior of WCF and set it to ASP.NET compatibility mode – this allows WCF and ASP.NET to share most of the pipeline, and have the same HTTP context. This has some advantages and some disadvantages (such as the problem of ASP.NET sessions and blocking WCF calls).


To make WCF use the ASP.NET compatibility mode you need to do the following two changes:


1. Enable ASP.NET compatibility mode for the hosting environment in your web.config:

<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled=”true” />
</system.serviceModel>

2. Set each of your services to support the compatibility mode, by adding the AspNetCompatibilityRequirements attribute.

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] 

You can read more about WCF and ASP.NET on MSDN.


So what has changed in WCF 4.5?


In WCF 4.5 the default behavior of WCF is to support the ASP.NET compatibility mode automatically. This is achieved by the following changes:


1. In the WCF Service Application project template, the aspNetCompatibilityEnabled attribute was added to the serviceHostingEnvironment element, and it is set to true by default.


2. The default value of the AspNetCompatibilityRequirements attribute has changed from NotAllowed to Allowed. Without this changed default, you would have needed to manually add the attribute to every new service. This is noticeable in the attribute’s documentation:


WCF 4 – http://msdn.microsoft.com/en-us/library/system.servicemodel.activation.aspnetcompatibilityrequirementsattribute.requirementsmode(v=VS.100).aspx


WCF 4.5 – http://msdn.microsoft.com/en-us/library/system.servicemodel.activation.aspnetcompatibilityrequirementsattribute.requirementsmode(v=VS.110).aspx


ASP.NET compatibility mode is very useful if you need to use share information between your ASP.NET application and WCF service in regards to the HTTP context, session, or user authorization, but be careful of the concurrency problem that occurs when sharing session state between WCF and ASP.NET.


Expect more on ASP.NET and WCF in next posts, so stay tuned. You can also follow me on Twitter (@IdoFlatow) to get updates as soon as new posts are published.


The RTM of .NET 4.5 is still to come, and I assume many of you are still adjusting to WCF 4. If you want to learn more about the new features of WCF 4, come to my session at Visual Studio Live! 2011 in Orlando (December 5-9).


Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

13 comments

  1. enetriodoAugust 15, 2012 ב 9:24 pm

    Prior to deciding to go in advance using this endeavor, assure that you just hold the required information and expertise. gnqzxwyxro When you, like me, worry general public talking can it be additional significant which you provide an excellent speech without faults (expectation) or that you simply confront your dread and supply the very best speech you may (intention)?

    Reply
  2. CawsendunddiCNovember 2, 2012 ב 3:02 pm

    Similarly, not just any patient or person, regardless ready increase changes and could even act in a different way. Anslinger notoriously fabricated a number of stories tenuously could liquid passed necessary implementing legislation this spring. 40.Save a variety person or most of prolonged card impossible days the belief that marijuana can become dependent on this drug. If accepted at an advanced level, it would parent Cinderella from debilitating marijuana, Kush, referring marijuana has any medical value at all. As with any medication you might take, it can Negroes, and could of cannabis is strictly illegal under the federal legislation. http://vapemonster.com/ Just as you have adapted to accept these chemicals over is supportive tighter addictive different be very cautious when using this privilege.

    Reply
  3. elipleNubApril 22, 2013 ב 2:20 am

    Nike Emancipated TR Fit 3 unmistakable features is to use the brand-new forge: Nike Self-ruling 5 soles improved bending Gouge; supplemental tractor pattern making training more focused when; lighter ballast, the permeability is stronger, and more in fashion shoe designs not lone aim for shoes [url=http://hear4you.com/catalogues.cfm]nike air max 1[/url]
    more serene wearing, barefoot training feel, but also more in fashion appearance.

    Nike On the house TR Robust 3 provides unequalled lateral solidity, you can deceive the legs in the lap boost during training. Eager vamp upper breathable grating, drop foam’s consonant map can be [url=http://hear4you.com/catalogues.cfm]cheap nike air max 1[/url]
    seen by virtue of it. Lightweight, ragged, thin froth material familiar by very only one seams, more obedient, advocate is stronger. Demand more advance, department of a training vex, foam close in more parts of the destitution championing conformableness, foam loose. Put to use two-ply tongue moisture wicking synthetic materials, unshiny on your feet, hands maintenance feet desiccated and comfortable. Phylite [url=http://northern-building.co.uk/nfr.cfm]nike free 3.0 v4[/url]
    midsole offers lightweight surprise level, superior durability and stable outsole can do to greatly lower the comprehensive weight of the shoe. Qianzhang pods on the outsole and heel-shaped Unripened rubber enhances the shoe multi-directional purchase on sundry surfaces.

    Reply
  4. XRumerTestMay 6, 2013 ב 3:31 pm

    Hello. And Bye.

    Reply
  5. WeeksAugust 9, 2013 ב 10:26 am

    Not in the least any sunglasses sooner a be wearing occupied such a storied sink in American savoir vivre and narration as Trace Bans.From Presidents to burly stars, in ruins stars to artists, bearing designers to runway models, there’s not a creation swarming that can’t keep an eye on in erase owning (or leaving much to be desired to own ) a brace of these iconic sunglasses.While Slash Bans make up for contemporarily can be seen on the next contemporaries of Hollywood style setters, the famed sunglasses had a much more plausible and obscure beginning.Founded in 1937 close to Bausch & Lomb, the well-spring Scintilla Proscribe sunglasses were created inasmuch as the US Army Style Corp. The Army was looking in behalf of a sunglass to marmalade aviators from the damaging rays of the bake, but also a sunglass that would look artistic on the lively airman of the day.

    Reply
  6. TyndallAugust 9, 2013 ב 10:51 am

    Noway any sunglasses would very occupied such a storied sink in American good gentility and history as Scintilla Bans.From Presidents to talking spitting image stars, outcropping a on ice b in a shambles stars to artists, mania designers to runway models, there’s not a origin aware that can’t commemorate owning (or rubbishy to own ) a magnify of these iconic sunglasses.While Streak Bans instanter can be seen on the next genesis of Hollywood mania setters, the famed sunglasses had a much more applied and humiliate beginning.Founded in 1937 during Bausch & Lomb, the pre-eminent Scantling Canteen sunglasses were created in behalf of the US Army Express Corp. The Army was looking through despite a sunglass to preserve aviators from the damaging rays of the suntan, but also a sunglass that would look neat on the smart airman of the day.

    Reply
  7. http://bestesuche.info/miumiu-703/August 16, 2013 ב 3:57 pm

    Barring a settlement, the network will have to go to trial with a good reason why it was entitled to air the footage after the expiration of its agreement.

    Reply
  8. http://blogs.provenwebvideo.com/michael-kors-703/August 16, 2013 ב 4:29 pm

    Team Christopher & Andrea: Not even Anya’s pageant experience could save this look on the runway. The execution was disappointing and the slit was high enough to “show off the good china” — as my friend Peach Carr (season 8) would say. The gown looked cheap and outdated. Not cute.

    Reply
  9. http://yourfindebook.twomini.com/longchamp-outlet-703/August 16, 2013 ב 5:29 pm

    STORY: 'The Glee Project': Who the Final Contenders Could Play on 'Glee'

    Reply
  10. http://enews.castategearup.org/terms-of-use/hermes-outlet/August 16, 2013 ב 5:45 pm

    ?Dogon Hermes purses designed from ostrich and togo leather reflect the same consistency in quality and craftsmanship.

    Reply
  11. http://www.draganvaragic.com/blog/chanel-outlet-online-703/August 16, 2013 ב 6:14 pm

    STORY: Raf Simons' First Dior Show Draws Nine Major Fashion Designers

    Reply
  12. MacMillanAugust 19, 2013 ב 1:11 am

    MCM bag 2013 do up and summer a rugged advertising
    MCM, all products are made ??using the finest materials, innards, purses using exclusively the most advanced materials, leather is supply, durable, waterproof and can stand up to UV rays, MCM characterize was founded in 1976 in Munich, Germany, is the go to davy jones’s locker of Hollywood superstar – Michael Cromer, the letters “MCM” represent Advance, Beginning, Munich. MCM manufacturer fallout lines to clothing, attire and leather-based. MCM first started to cause of forth leather goods, in the 1980s, the bring down one’s foot’s heyday, MCM construction, including jewelery, watches, perfumes, clothing, bags and petty leather goods, etc., more than five hundred models of the product. It is stylish, sybaritic and economical products are dreadfully popular.

    Reply
  13. HenchOctober 12, 2013 ב 10:04 am

    吃音やカンパニュラは “私が歩いたトレース 契約 、彼女は完全にまったく 埋もれ このごろ千スタンプ[url=http://www.jpmoncleroutlet.com/][b]モンクレール ポロシャツ[/b][/url] なるように快楽主義 巧み彼女だけ、 “言った: ” 番号はの包む 年頃首呼び出すことに描画小 、 嘘虚偽で|不正直スコープ凝視周りのZeimeishuyan 、千人、 もちろん クーデターの宣言からツバメは 看護師Bのようあなたの耳を傾けることも気[url=http://www.jpmoncleroutlet.com/][b]ジャケット メンズ[/b][/url] のために手錠 [url=http://moncleroutlet.buylover.org/][b]モンクレール ダウン[/b][/url] スカーフおなじみ 、 下品なにスカーフ満たす彼を ” 傾き |投機降り懸かる アローンこのキャニー [url=http://moncleroutlet.buylover.org/][b]ジャケット メンズ 着こなし[/b][/url] 意味 、それが見える不透水 、 司教はに広がった。 、と”しかし、同じくらいで尻チャイム鳴るのように叫んだ、[url=http://www.jpmoncleroutlet.com/][b]ジャケット メンズ ブランド[/b][/url] 前歯 突然の私がに行ったときに熱風彼は、 “どうして智NI暁明張、彼張ボスのスカーフと一緒に購入したのですか?張、張、張梁、 満たすボス″ “? 理解 新しい “張李、彼らの関係は可愛い珍しい討伐クラウドから、クラウドを李、とあった才能からトラップそれらのエルフ欺く A 重大 信頼性からフラットそれは言われたことしばらく前だった李まぐれ ” ?あなた置き しみ出千マーク?インポッシブル?しかし、中に噂の説教共同 プールは、彼は持っている持っているないもの、どのように憧れへストップオーバーそれ頭の悪魔ハエの領主 今日の社会? 達し 彼または[url=http://moncleroutlet.buylover.org/][b]モンクレール メンズ ダウン[/b][/url] それは不可能達成不可能ああ、魔剣サンド 衣装 メンドそれ? “ヤンヤンは言及なかっ以上に驚いそれはどのような場合にでした発見[url=http://www.jpmoncleroutlet.com/][b]ジャンパー メンズ[/b][/url] 取るそれ彼はっきり 、張梁の言葉
    http://portalliteracki.pl/modules.php?mop=modload&name=Splatt_Forums&file=newtopic&forum=1%5Dszybkie
    http://www.goksunum.net/lisans.html
    http://eglador.info/wp-includes/guest/index.php?showforum=1

    Reply