My last post was regarding how to refresh CS07 cache concerning the web services. It is important to note however that when you are dealing with Mojave code, such as working on the Default Site that ships with CTP4 (or upcoming CTP5), that the code does not use these web services. These web services are used by integration applications (e.g. Biztalk) or the management application MMCs (e.g. Customers and Orders Manager, Catalog Manager, etc.).
One example would be when you a user adds a credit card to his profile. A new credit card entry is created which includes all the information e.g. credit card number, expiry date, etc. However, it does not include the DateCreated i.e. the time stamp at which the user created the credit card entry on the site. This attribute is filled in on the Commerce Server/Sql Server side. Therefore your local cached copy of the newly created credit card will not have DateCreated attribute in the cache. Why is this a problem? Well, if you want to sort the credit cards by DateCreated attribute, this is a problem. You will not be able to do a meaningful sort until and unless the CS07 cache refreshes. An iisreset, for example, will clear the cache for you. Note that resetting the cache from the management applications or changing the settings in the Commerce Server web services' web.config will have no effect. Remember, you are making Mojave calls which are going straight to CS07 (Microsoft.CommerceServer.* libraries). The web services are simply not in the play here.
So, how do you refresh Commerce Server 2007 cache from Mojave API? There are two ways:
1. Directly Using CommerceUpdate
CommerceUpdate
updateCache.SearchCriteria.Model.Name = "ProfileCache";
CommerceResponse response = OperationService.ProcessRequest(GetCurrentRequestContext(), updateCache.ToRequest());
2. When a CommerceQuery
CommerceQuery
query.SearchCriteria.Model.DateModified = DateTime.UtcNow;
query.SearchCriteria.Model.Email = email;
Refreshing Cache in Commerce Server 2007
Posted by Commerce Server Guy on Wednesday, December 17, 2008Commerce Server heavily reiles on caching to keep the application flowing nice and tidy. During development, there may be cases where you want the application to go and fetch data right from the source and bypass the cache. There are a couple of things you can do:
- From the management applications, e.g. Commerce Server Customers and Order manager, you can click on the Profiles or Payment Methods, and then click "Refresh Site Cache" from the task pane.

- You can browse to the following URL: http://webserver:webservicesPort/OrdersWebService/SiteCacheRefresh.axd?CacheToRefresh=ProfileCache (replace ProfileCache with whichever cache you are trying to refresh).
- If you get an access denied error, then you need to add the owner of your application pool to the appropriate section in the web.config of the web services. Look for "SiteCacheRefresh.axd" in your web service's web.config and it will have "
". In that section allow access to your application pool owner, or (for development box only) change "deny" to "allow" in the above tag giving everyone free access.
If you have a tree folder as follows:
%BRANCHPATH%\UserControls
%BRANCHPATH%\UserControls\ChangePassword\
%BRANCHPATH%\UserControls\MyProfile\
%BRANCHPATH%\UserControls\RegistrationWizard\
and you try to do a XCOPY as follows using the recursive option (/S), it copies entire folder structure into the target hive.
XCOPY %BRANCHPATH%\*.ascx "%HIVE%" /Y /R /S
However, if we just want to drop the files individually the above doesn’t work. The above will copy entire folders that contain the ascx files in the HIVE. This will cause problems. There is no way to do a tree-to-flat copy using any XCopy option.
One easy but cumbersome way to avoid this is to use full paths to each folder as follows:
XCOPY %BRANCHPATH%\UserControls\*.ascx "%HIVE%" /Y /R
XCOPY %BRANCHPATH%\UserControls\ChangePassword\*.ascx "%HIVE%" /Y /R
XCOPY %BRANCHPATH%\UserControls\MyProfile\*.ascx "%HIVE%" /Y /R
XCOPY %BRANCHPATH%\UserControls\RegistrationWizard\*.ascx "%HIVE%" /Y /R
The above will work, but you will have to specify each folder, and there may be a folder you end up missing. However, the following snippet is generic enough in that it will first create a list of all the folders and subfolders, create a temporary list of folders in a text file, go through each folder, grab the .ascx files in each folder and copy it to the HIVE. At the end delete the temporary text file:
dir %BRANCHPATH%\UserControls /A:D /B /S > tempListOfDirs.txt
For /F %%A IN (tempListOfDirs.txt) Do (
If Exist %%A* (
XCOPY %%A\*.ascx "%HIVE%" /Y /R
)
)
del tempListOfDirs.txt
Automatic TFS Sign-in on Microsoft Server 2008
Posted by Commerce Server Guy on Monday, December 15, 2008
Do the following so VS doesn’t bother you each time for logging in when you fire it up. Note that if you want to log on using another ID, you will have to go back here and remove the cached password from the entry. These are instructions for Microsoft Server 2008.
Control Panel > User Accounts > Manage Your Network Passwords
Click Add
Enter information as below with your username and password. Note that you won’t have the options grayed out – mine are grayed out because I am trying to edit an existing property. You will be able to type in the log on box (enter your tfs server name e.g. tfs.companyname.com) and choose the radio button.
I am a Microsoft Commerce Server newbie. I will be working with the latest MS offering codenamed Mojave at my current place of employment. As I get more familiar with this product, the purpose of this blog is to share any development experiences and other teething pains to hopefully help someone else out there get up to speed quickly.