Differences between revisions 9 and 11 (spanning 2 versions)
Revision 9 as of 2020-10-08 01:49:59
Size: 1550
Editor: scot
Comment:
Revision 11 as of 2020-10-11 17:19:41
Size: 3182
Editor: scot
Comment:
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
 * Add a Windows firewall rule to allow incoming connections to port 1433. (if you are not sure how to do this, ask an IT major or google it)
Line 30: Line 31:

One of the most important things is that, when working with the latest technology, we use the latest documentation. I didn’t give you links to the latest documentation, I gave you a link to a tutorial that shows the process. Always look at the date for such tutorials, they may (and indeed often do) require you to expand your search to find ''current'', '''''canonical''''' documentation.

 1. You have your WCF service App project (hereafter referred to as your “service” project). This is what gets deployed and this is where I’ll be making the majority of edits (almost all in the web.config file).
 1. Deploy the service to your remote IIS server.
    a. Test this! If it doesn't work now, it doesn't have a prayer of working later.
 1. At this point, I looked at the project called Membership and Role Provider in the link below:
    a. [[https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/membership-and-role-provider|Membership and Role Provider]]
    a. Although this does show you how to change the web.config file, it does not show you much code. So to save you downloading a massive file and finding the right project in it, I’ve included the folder for this project [[here]]
NOTE: Your Membership and Role Provider is untrusted! That is, even though this is a standard normal forms authentication provider, IIS will complain. So follow the directions here to fix that problem. BUT BE WARNED, DON’T EVER DO THIS ON A PRODUCTION SERVER.

 

Adding Authentication/Authorization

These directions are based on chsakell's Blog Post

Step 1: Database Setup

  • Install Sql Server Express
    • Make sure to use both Windows and SQL authentication
    • Instance = [servername]\SQLEXPRESS).
  • Install Sql Server Management Studio (SSMS) on the server
  • Start SSMS and connect to [servname]\SQLEXPRESS
    • Right click on the server and select properties
    • Select the connections page
    • Click allow remote connections and select ok.
  • Start Sql Server Configuration Manager
    • Set the following elements SqlConfig.png

    • Under "SQL Server Services" Right click on "SQL Server (SQLEXPRESS)" and click restart.
  • Add a Windows firewall rule to allow incoming connections to port 1433. (if you are not sure how to do this, ask an IT major or google it)
    • You can now remotely connect to the server using just the IP address. Try it on SSMS
  • Create a database
    • In SSMS, right click on the databases folder, select New Database...
    • Give it a name "MovieUsers"

  • Run C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regsql.exe

    • Choose the Configure SQL Server for application services option and select next.
    • Fill in the server name and append "\SQLEXPRESS" e.g. CPTR446\SQLEXPRESS
    • Leave Windows authentication selected and Drop down the database selection. You should see MovieUsers. Select it and click next, next, finish.

That should finish the database setup.

Step 2: Configure your service to use the database for authentication

One of the most important things is that, when working with the latest technology, we use the latest documentation. I didn’t give you links to the latest documentation, I gave you a link to a tutorial that shows the process. Always look at the date for such tutorials, they may (and indeed often do) require you to expand your search to find current, canonical documentation.

  1. You have your WCF service App project (hereafter referred to as your “service” project). This is what gets deployed and this is where I’ll be making the majority of edits (almost all in the web.config file).
  2. Deploy the service to your remote IIS server.
    1. Test this! If it doesn't work now, it doesn't have a prayer of working later.
  3. At this point, I looked at the project called Membership and Role Provider in the link below:
    1. Membership and Role Provider

    2. Although this does show you how to change the web.config file, it does not show you much code. So to save you downloading a massive file and finding the right project in it, I’ve included the folder for this project here

NOTE: Your Membership and Role Provider is untrusted! That is, even though this is a standard normal forms authentication provider, IIS will complain. So follow the directions here to fix that problem. BUT BE WARNED, DON’T EVER DO THIS ON A PRODUCTION SERVER.

WebServices/ProgrammingHomeworks2020/HW05 (last edited 2020-10-11 20:14:58 by scot)