11.07.2015 Views

y - Net Developer

y - Net Developer

y - Net Developer

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 5 ■ HOSTING AND CONSUMING WCF SERVICES 165ramrameshreddy.blog.com}[Asp<strong>Net</strong>CompatibilityRequirements(RequirementsMode=Asp<strong>Net</strong>CompatibilityRequirementsMode.Allowed)]public class TradeService : ITradeService{...}The Asp<strong>Net</strong>CompatibilityRequirementsMode attribute has the following allowed values:NotAllowed: Indicates your services may never be run in the ASP.NET compatibility mode.You have to set this in scenarios where your service implementation doesn’t work inASP.NET compatibility mode, such as in scenarios where your services are not built forHTTP.Allowed: Indicates your services may run in the ASP.NET compatibility mode. Pick thisvalue only when you know your service may work in this mode.Required: Indicates your service must run in the ASP.NET compatibility mode. Pick thisvalue when your service requires persistent session storage.When you choose the Required option, WCF will verify that all the supported endpointsfor the services are HTTP endpoints and will throw an exception during ServiceHost initializationif they aren’t. In addition to the Asp<strong>Net</strong>CompatibilityRequirements attribute, you must setasp<strong>Net</strong>CompatibilityEnabled, as shown in Listing 5-10.Listing 5-10. Configuration with ASP.NET Compatibility Enabled......ramrameshreddyramrameshreddy■Note The sample code that comes with this book contains the TradeService service hosted in theExchangeServiceInline.svc file that is configured to run in ASP.NET compatibility mode. You can find itby opening the Chapter 5 solution file.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!