Microsoft Mobile Developers Handbook
Chapter 7 Sample Files Readme
To run the samples in Chapter 7, you'll need to create a new
database called DotNetCF on the SQL Server.
To create the database, you can start SQL Server Management
Studio and right-click Databases in the Object Explorer and
select New Database from the context menu. In the Database
Properties window, enter 'DotNetCF' in the Name field and
click the OK button.
To create the DotNetCF database objects, click Open File from
the File menu and navigate to the DotNetCF.sql script located
in the same folder as this Readme file. Ensure that 'DotNetCF'
is the selected database in the database selector dropdown
in the tolbar and then click Execute.
You'll also need to set access permissions for the database
objects so that the Windows User Account you want to use with
the sample code can access the database (Remember that when code
running on the device passes user credentials to SQL Server, they are
not necessarily the same user credentials as the account you use
to log onto Windows for software development).
You can set the user permissions using SQL Server Management Studio.
Select the Security node and then Logins from the left pane.
Then, either right-click an existing login that you want to use, or
right-click on Logins, and then click New Login to create a new
database login for an existing Windows Account.
In the Properties for the login, go to the User Mapping page,
make sure that the DotNetCF database is selected, and that you have
put the login into an appropriate database role, such as db_datareader
and db_datawriter.
If you are experiencing problems connecting to SQLServer from the device
even though everything is correct, be sure to check that you have enabled
TCP/IP access to SQL server.
To do this go the start menu and locate SQL Server 2005, highlight
Configuration tools, and then select SQL Server Configuration Manager
from the list. From the management console that appears open up the
SQL Server 2005 Network Configuration item, then highlight the Protocols
for MSSQLSERVER item. Then in the right hand pane check that TCP/IP is
enabled.
Special Note for the CompressionService:
------------------
The CompressionService Web service uses SQL Server 2005 Express for data storage.
If you do not have SQL Server express installed but you do have SQL Server, you
must attach the SampleDatabase.mdf to your SQL server installation and modify the
cnnection string accordingly.
To attach a database to SQL server simply launch SQL management studio and connect
to the instance of SQL that you will be using. Locate the databases icon from the object explorer
and right click, then select attach. Click Add from the windows that appears then locate the
Sampledatabase.mdf on the filesystem.
Change the database name to something more manageable, and your done. (Obviously you still
need to change the connection string within the CompressionService Web service code)
Refer to Chapter 7 for more information on running the sample
code.
Configuring the Websites
========================
To setup the Web Services, do the following:
1. Copy the contents of the Websites folder to C:\Inetpub\wwwroot
(or if you have configured an alternative location for IIS Websites,
copy to that folder).
Windows Vista:
--------------
a) Start - Control Panel - Administrative Tools - Internet Information Services (IIS) Manager
b) Expand the folder list in the Connection pane
c) Right-click on 'Default Website', then click 'Add Application'
d) In the 'Add Application' dialog, set the Physical Path by navigating to the folder
for one of the wbsites. Enter the name of the Web Service folder in the Alias box also.
(For example, enter BasicAuthService for the alias, and C:\Inetpub\wwwroot\BasicAuthService
for the physical path). Click OK.
e) Repeat for all Websites.
For the BasicAuthService only:
i) Select the BasicAuthService under DefaultWebService in the Connections pane.
ii) Double-click Authentication
iii) Set Basic Authentication to 'Enabled' and all other authentication settings to 'Disabled'.
Windows XP:
-----------
a) Start - Control Panel - Administrative Tools - Internet Information Services (IIS) Manager
b) Expand the folder list in the left hand pane - you will see folders for each
of the websites shown under 'Default Website'
c) Right-click on a website folder, then click 'Properties'
d) In the General tab of the Properties dialog, click the 'Create' button in the Application pane
e) Check that on the ASP.NET tab, the ASP.NET versions shows V2.0.50727 - change if necessary.
f) Repeat for all Websites.
For the BasicAuthService only:
i) Open the Properties for the BasicAuthService Website.
ii) Select the 'Directory Security' pane,then click the Authentication button
iii) Check Basic Authentication.
评论0