【PetShop4.0】一 安装及connectionstring加密

大名鼎鼎的"宠物大战",你一定听过了。是学习架构,平台的一个很好的范例。
正好最近闲来无事,下了个petshop4.0回来研究研究。

基于.NET平台的petshop4.0,下载地址:
http://download.microsoft.com/download/8/0/1/801ff297-aea6-46b9-8e11-810df5df1032/Microsoft%20.NET%20Pet%20Shop%204.0.msi
(微软的架构网站上面给出的链接竟然不对,本想报个bug,想想还是算了)

安装。。。没什么说的。

【第一个问题】:选择source only 或者source + db 发现最后生成的web.config有所不同

Source only

<?xml version="1.0" ?> 
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<connectionStrings>
        <!--  SQL connection string for Profile database   --> 
       <add name="SQLProfileConnString" connectionString="server=(local);user id=mspetshop;password=pass@word1;database=MSPetShop4Profile;min pool size=4;max pool size=4;packet size=3072" providerName="System.Data.SqlClient" /> 
         ...
</connectionStrings>
<appSettings>...</appSettings>
<system.web>...</system.web>
<location path="UserProfile.aspx">...
<location path="CheckOut.aspx">...
</configuration>

Source + DB

<connectionStrings configProtectionProvider="RsaProtectedConfigurationProvider"> 
     <EncryptedData Type="http://www.w3.org/2001/04/xmlenc#Element" xmlns="http://www.w3.org/2001/04/xmlenc#">
          <CipherData>      
               <
CipherValue>mSqCDMQF...//==</CipherValue> 
         </CipherData>
     </EncryptedData>
</connectionStrings>

其实是用cipherData对ConnectionStrings进行了encrypt和decrypt 

这方面详细解释
http://www.asp.net/learn/data-access/tutorial-73-cs.aspx (E)
http://www.cnblogs.com/lizhiwen/archive/2007/10/26/938280.html (中文)

petshop用的是 “用aspnet_regiis.exe对配置节点进行加密”这种
EncryptWebConfig.bat
@echo off
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pef "connectionStrings" "C:\Program Files\Microsoft\.NET Pet Shop 4.0\Web"
PAUSE

DecryptWebConfig.bat
@echo off
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -pdf "connectionStrings" "C:\Program Files\Microsoft\.NET Pet Shop 4.0\Web"
PAUSE

 

 

【第二个问题】数据库链接设置 Bug report

安装好后,打开,运行,结果出错了,错误信息如下:
Server Error in '/Web' Application.
--------------------------------------------------------------------------------
Login failed for user 'mspetshop'. The user is not associated with a trusted SQL Server connection.

因为我选择的Server Type是SQL Server 2005,需要设置
运行 SQL Server Management Studio,在服务器名上右键,选择属性->安全,在服务器认证部分选择
SQL Server和Windows验证模式,然后重启SQL Server服务。

选择SQL Server Express没有这个问题

Bug Report: delete issue...

Repro steps:

1.       Run petshop4.0

2.       add some pets by clicking ‘add to wish list’

3.       in WISH LIST, delete an item by clicking ‘x’

4.       click ‘continue shopping’

 

Expected:

         Go to pets page

Actual:

         The deleted item will come up again


 

你可能感兴趣的:(Connection)