Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 6 > BOOK: Professional C# 6 and .NET Core 1.0
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional C# 6 and .NET Core 1.0
This is the forum to discuss the Wrox book Professional C# 6 and .NET Core 1.0 by Christian Nagel; ISBN: 978-1-119-09660-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C# 6 and .NET Core 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 23rd, 2016, 09:58 AM
Authorized User
Points: 66, Level: 1
Points: 66, Level: 1 Points: 66, Level: 1 Points: 66, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2016
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default Chapt 40: pg1248-1249 - SessionState

When I run the example I get this in the browser:

Unable to resolve service for type 'Microsoft.AspNetCore.DataProtection.IDataProtecti onProvider' while attempting to activate 'Microsoft.AspNetCore.Session.SessionMiddleware'.

I found the fix here:
https://forums.asp.net/t/2097262.asp...on+not+working

1) Add in your project.json as below
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",

2)In your ConfigureServices method of Startup.cs
services.AddMemoryCache();
services.AddSession()

-----------------------------------

Also, after I get to "Configure ASP.Net" on p 1249, and add the appsettings.json and the StartUp constructor, I start getting this error:
"Unable to resolve service for type 'Microsoft.Extensions.Caching.Distributed.IDistrib utedCache' while attempting to activate 'Microsoft.AspNetCore.Session.DistributedSessionSt ore'."

I found a resolution at:
https://docs.microsoft.com/en-us/asp...tals/app-state
services.AddMemoryCache();
from step 2 above
with
services.AddDistributedMemoryCache();

I'll have to read more about State now;.
Looks like a lot of changes:
No more Application replaced with Cache, and so on.

Just replace:

Last edited by smiller781; December 23rd, 2016 at 11:15 AM.
Reply With Quote
  #2 (permalink)  
Old January 3rd, 2017, 05:49 AM
Wrox Author
Points: 1,151, Level: 13
Points: 1,151, Level: 13 Points: 1,151, Level: 13 Points: 1,151, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2010
Location: Austria
Posts: 171
Thanks: 2
Thanked 53 Times in 53 Posts
Default

Thanks for the note. The code download was already updated, but I missed adding the information to the book updates.

Updated information added here:
https://github.com/ProfessionalCShar...BookUpdates.md

I'm also sending an update for the Wrox errata list.

Thanks
__________________
Christian
CN innovation
Visit my blog at: csharp.christiannagel.com
Follow me on twitter: @christiannagel
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapt 40: pg.1240-1241 - Form Data smiller781 BOOK: Professional C# 6 and .NET Core 1.0 3 January 17th, 2017 01:36 PM
Sessionstate larsp777 BOOK: Beginning ASP.NET 4 : in C# and VB 6 September 27th, 2012 03:09 AM
SessionState Lost lpeoples BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 4 August 24th, 2010 08:02 AM
Sessionstate jgrant ASP.NET 2.0 Basics 1 August 26th, 2007 01:36 PM
Unrecognized configuration section 'sessionState' Shihanshin BOOK: ASP.NET Website Programming Problem-Design-Solution 1 May 27th, 2005 05:30 PM



All times are GMT -4. The time now is 01:14 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.