Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 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 Search this Thread Display Modes
  #1 (permalink)  
Old August 15th, 2018, 09:30 PM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2018
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Default Chapter 16 Try it Out Using WSAT to manage user accounts and roles Error

I am trying to access the security tab of my WSAT site while IISExpress is runnning on command prompt.

After I log on my credentials and click the security tab. I have to wait for a few minutes before it pops up for this error:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.


I tried configuring Role Manager by turning to enable true on webconfig

Code:
<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
  </configSections>
  <connectionStrings>
    <add name="PlanetWroxConnectionString1" connectionString="Data Source=LAPTOP-EOKIPLB6\SQLEXPRESS;Initial Catalog=PlanetWrox;Integrated Security=True" providerName="System.Data.SqlClient" />
    <add name="PlanetWr0xConnectionString1" connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\PlanetWr0x.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />

  </connectionStrings>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
  </appSettings>
  <system.web>
    <authentication mode ="Forms">
      <forms loginUrl="~/Login"/>
    </authentication>
    <pages theme="Monochrome">
      <controls>
        <add tagPrefix="Wrox" tagName="Banner" src="~/Controls/Banner.ascx" />
      </controls>
    </pages>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
    <profile defaultProvider="DefaultProfileProvider">
      <providers>
        <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="PlanetWr0xConnectionString1" applicationName="/" />
      </providers>
    </profile>
    <membership defaultProvider="DefaultMembershipProvider">
      <providers>
        <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="PlanetWr0xConnectionString1" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>
    <roleManager defaultProvider="DefaultRoleProvider" enabled="true">
      <providers>
        <add name="DefaultRoleProvider"
             type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers,
             Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      connectionStringName="PlanetWr0xConnectionString1"
             applicationName="/" />
      </providers>
    </roleManager>
    <!--
            If you are deploying to a cloud environment that has multiple web server instances,
            you should change session state mode from "InProc" to "Custom". In addition,
            change the connection string named "DefaultConnection" to connect to an instance
            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.
      -->
    <sessionState mode="InProc" customProvider="DefaultSessionProvider">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="PlanetWr0xConnectionString1" />
      </providers>
    </sessionState>
  </system.web>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory" from="Planet Wrox &lt;planetwrox@example.com&gt;">
        <specifiedPickupDirectory pickupDirectoryLocation="C:\TempMail" />
      </smtp>
    </mailSettings>
  </system.net>
  <system.serviceModel>
    <behaviors>
      <endpointBehaviors>
        <behavior name="NameServiceAspNetAjaxBehavior">
          <enableWebScript />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service name="NameService">
        <endpoint address="" behaviorConfiguration="NameServiceAspNetAjaxBehavior" binding="webHttpBinding" contract="NameService" />
      </service>
    </services>
  </system.serviceModel>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
</configuration>
I'm not sure where to proceed from here.

Last edited by AspLearner17; August 15th, 2018 at 09:36 PM..
Reply With Quote
  #2 (permalink)  
Old August 16th, 2018, 02:27 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Are you connection strings pointing to the right server and database? I see these two:

LAPTOP-EOKIPLB6\SQLEXPRESS
(LocalDB)\MSSQLLocalDB

Do both exist and can you log int to them using SSMS? If not, you'll need to update the connection strings.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
AspLearner17 (August 16th, 2018)
  #3 (permalink)  
Old August 16th, 2018, 02:51 AM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2018
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Thanks I removed LAPTOP-EOKIPLB6\SQLEXPRESS connection string.
Right now, only (LocalDB)\MSSQLLocalDB exists because i had mistakenly made the first database on the wrong server which caused permission problems when I tried to zip my website. So I changed to the localdb server so I could solve that.

My new problem right now is that when I try to re-enter this on command line:


c:\Program Files\IIS Express>iisexpress.exe /path:"c:\windows\microsoft.net\framework\v4.0.3031 9\asp.netwebadminfiles" /vpath:"/asp.netwebadminfiles" /port:8082 /clr:4.0 /ntlm

I get
"This app can't run on your pc to find a version for your pc check with the software publisher"
and

"Access is denied" error on command prompt

I tried this with both regular and administrative cmd line.
I don't understand where the error coming from since I didn't change anything. I simply used q to stop my IIS express from running and tried to re run the command.
Reply With Quote
  #4 (permalink)  
Old August 16th, 2018, 04:11 AM
Imar's Avatar
Wrox Author
Points: 72,022, Level: 100
Points: 72,022, Level: 100 Points: 72,022, Level: 100 Points: 72,022, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,076
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Try running the command from C:\Program Files (x86)\IIS Express rather than from C:\Program Files\IIS Express

That does it for me (get the same error on C:\Program Files\IIS Express)

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
AspLearner17 (August 16th, 2018)
  #5 (permalink)  
Old August 16th, 2018, 04:29 AM
Registered User
Points: 20, Level: 1
Points: 20, Level: 1 Points: 20, Level: 1 Points: 20, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2018
Posts: 5
Thanks: 3
Thanked 0 Times in 0 Posts
Default

IT WORKED! Thank you!!! you are the absolute best.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Problem with WSAT Chapter 16 Teop74 BOOK: Beginning ASP.NET 4.5 : in C# and VB 2 September 8th, 2018 03:30 AM
Chapter 16 - WSAT hirons BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 10 January 18th, 2016 06:22 PM
Chapter 16: Using the WSAT to Manage User Accounts and Roles phztfte1 BOOK: Beginning ASP.NET 4.5.1 : in C# and VB 9 January 18th, 2016 04:29 PM
Ch 16-17 User accounts AlanWheeler BOOK: Beginning ASP.NET 4.5 : in C# and VB 1 February 24th, 2014 04:54 PM
Creating page to manage user roles Notso ASP.NET 4 General Discussion 1 April 14th, 2013 11:31 PM



All times are GMT -4. The time now is 03:57 AM.


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