Issues with SiteCacheRefresh.axd and Host Headers
I have setup Commerce Server 2007 Enterprise edition. Everything is working and we went live with code just recently. However the biggest complaint is when our products manager enters in inventory and well products and saves the items he wants to refresh our web app to see the products just added. So he hits the refresh site cache and the most interesting error comes up:
"Event Type: Error
Event Source: Commerce Server Web Services
Event Category: None
Event ID: 4
Date: 4/2/2008
Time: 3:30:06 PM
User: N/A
Computer: MountainDew
Description:
An exception occurred in the 'OrdersWebService' Web service. Exception details follow:Microsoft.CommerceServer.CacheRefreshFailedException: One or more errors occurred while refreshing the cache 'ShippingManagerCache' of the site 'CodeRed':
The server 'MountainDew' of the application 'OrdersWebService' returned HTTP status code 404 (Not Found). The cache refresh URL used was 'http://MountainDew/OrdersWebService/SiteCacheRefresh.axd?CacheToRefresh=ShippingManagerCache'.The server 'MountainDew' of the application 'CodeRed' returned HTTP status code 404 (Not Found). The cache refresh URL used was 'http://MountainDew/SiteCacheRefresh.axd?CacheToRefresh=ShippingManagerCache'.
See the server event event log for more details.
at Microsoft.CommerceServer.Runtime.Configuration.CommerceResourceCollection.HandleErrors(List`1& failures, String cacheName, CommerceResourceCollection resourceCollection)
at Microsoft.CommerceServer.Runtime.Configuration.CommerceResourceCollection.RefreshCache(String cacheName, CommerceResourceCollection resourceCollection)
at Microsoft.CommerceServer.Orders.DataManagement.ServerOrderSystem.RefreshShippingMethodCache()
at Microsoft.CommerceServer.Orders.WebService.OrdersWebService.RefreshShippingMethodCache()For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp."
As Highlighted above MounatinDew is our "machine name" not our "domain name". Color me purple but I think the webservice should be something like this: http:// or https:// your domain name.com/OrdersWebService/SiteCacheRefresh.axd? ?
Is there a way to let IIS handle the URL? Map it to the physical path. If so could you help me with this? Give me a clue.
I found this:
"string requestUri = http://<your site>/SiteCacheRefresh.axd?CacheToRefresh=<your cached system>;
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUri);
request.UseDefaultCredentials = true;
HttpWebResponse response = (HttpWebResponse) request.GetResponse();"
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1570092&SiteID=1
Which looks promising However where does it go?
Please let me know. Thanks,
Answers
mike,
take a look at the web.config file, maybe there´s a location tag for the SiteCacheRefresh.axd address. something like this:
<location path="SiteCacheRefresh.axd"><system.web>
<authorization>
<deny users="*"/>
</authorization>
</system.web>
</location>
The appPool user must be granted here.
All Replies
Maybe this link can help you.
http://weblogs.asp.net/andrenobre/archive/2008/02/14/404-on-sitecacherefresh-axd.aspx
Mike,
first you need to find wich URL is the correct, browsing manually, to find what is the problem.
Some questions about:
1- What is the address of you app in your local machine?
2- Is this address a specific host header?
3- If you try browse to http://<your-domain>/<your-app>/SiteCacheRefresh.axd?CacheToRefresh=ShoppingManagerCache, what happen?
Andre,
Thanks for fielding this. Here is the answers:
1-C:\CodeRed\wwwroot\Services\OrdersWebService That is the physical address.
2-Specific as in the host header has that address? No It does however have just the machine name "MountainDew".
Server Error in '/CatalogWebService' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /CatalogWebService/SiteCacheRefresh.axdPlease steer me in the right direction.
Thanks,
Mike Dopp
-Critically frustrated with this.
Try add a new host header with the same values of the existing one, but with prototypeservices.codered.com in the value field.
So if I understand correctly I should have put prototypeservices.codered.com into the value or host header. However it is already in there. Should it be taken out and only the machine name be present?No, you should have both in there, just like that article from my blog.
If it´s not working, I don´t have any other idea about this problem, sorry
- Andre,
Thanks for your help. Could you email me the way you would have installed commerce server 2007 with the SiteCacheRefresh working? So that I might do a comparison to what I might have messed up.
Thanks, - Mike,
I follow this install instructions, and everything went fine. The only thing that I´d configured was the host header thing.
Here´s the link:
http://msdn2.microsoft.com/en-us/library/aa545548.aspx Thanks for the link. Is there a way to create my own sitecacherefresh.axd without it having to be created by the other (orders) webservice?
The SiteCacheRefresh implementation is the same for the web services and for the CS Application.
Creating your own is possible, but I´m sure it´s not recommended. It´s implementation has too many details, that in some part you can forget or misunderstand .
Anyway, if you want to search for more information about it´s implementation, look for Microsoft.CommerceServer.Runtime.SiteCacheRefresh class.
Would the folder structure on the server be the issue with sitecache refresh? example: c:\<app Name>\<wwwroot>\<app Folder> or <Services> Any Ideas? Kinda grabbing at straws at this point.
I have been hammering at this for 2 weeks now. I am wondering could the 404 that I am getting due to a self signed cert?
Mike,
First off, the url you need to try in your browser is the URL on your *site*, not on your CatalogWebservice so instead of "http://prototypeservices.codered.com/CatalogWebService/SiteCacheRefresh.axd?CacheToRefresh=ShoppingManagerCache", try "http://[www.YourSite.com]/[path to your commerce server application]/SiteCacheRefresh.axd?CacheToRefresh=ShoppingManagerCache"
Second, i believe that the web service looks to the "Applications" entries in the commerce server manager to figure out where to refresh the cache. check that the non-secure host name and the IIS Application path are set correctly.
Michael.
Mike,
In your web site properties (Computer Management > IIS > Web Sites > [your web site] > right-clic > properties), could you check your ISAPI extension mappings (Home Directory tab > Configuration button > Mappings) ?
The ".axd" extension must be associated to "c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll" as the aspx one. If not, add a new mapping.
Last thing, verify that the checkbox "Verify that file exists" is unchecked in the mapping properties.
Hope this helps,
Antoine.
So I tried all of that I even went into commerce Server Management to change all the info.I still get this:
http://prototypeadmin.lifetime.com/RefreshError.jpg
I will get a list of configs together. I must be missing something so small.
- Mike,
just to reiterate: the SiteCacheRefresh.axd lives in your site. the url in the screencap looks like you're trying to access it within the OrdersWebservice.
you also want to make sure that you have the following line in the HttpHandlers section of your site web.config:
<add path="SiteCacheRefresh.axd" verb="GET" type="Microsoft.CommerceServer.Runtime.SiteCacheRefresh, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " />
Michael. Here is how the site is setup.
C:\<app Name>\wwwroot\<Site Folder: Named after the app Name> and <Services Folder: Containing only the Services Folders>
The sites are setup in IIS like this:
Web Sites
Main Site:
<siteName> in properties I have set an IP address with ports 80 and 443(for SSL or course) in the Host Header it reads
Port 80 Headers
<siteName.com> Port 80 With the IP address
<Machine Name (in CAPS)> Port 80 with the IP Address
Port 443 Headers
IP Address and Port 443
Services Site:
Services.<siteName> in properties IP address with ports 80 and 443(for SSL or course) in the Host Header it reads:
Port 80 Headers
Services.<siteName.com> Port 80 With the IP address
<Machine Name (in CAPS)> Port 80 with the IP Address
Port 443 Headers
IP Address and Port 443
Both Sites have the ISAPI extentions settings:
Extension: .axd Executable: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
Verbs: All verbs is bulleted
Script engine is checked
Verify that file exists is unchecked.
The main site has its own app pool.
Each Services has its own app pool.
I do have a self signed cert for testing.
The Main site as well as each service web.config has:
<add verb="*" path="SiteCacheRefresh.axd" type="Microsoft.CommerceServer.Runtime.SiteCacheRefresh, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 "/>
<add path="SiteCacheRefresh.axd" verb="GET" type="Microsoft.CommerceServer.Runtime.SiteCacheRefresh, Microsoft.CommerceServer.Runtime, Version=6.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 " />
In the <httpHandlers>
As Well as:
<location path="SiteCacheRefresh.axd">
<system.web>
<authorization>
<allow roles="<siteName>\CacheRefresh_SG"/>
<allow roles="Services.<siteName>\CacheRefresh_SG"/>
<allow roles="BUILTIN\Administrators"/>
<allow roles="<machineName>\CatalogAdminGroup"/>
<allow roles="<machineName>\ProfilesAdminGroup"/>
<allow roles="<machineName>\CacheRefresh_SG"/>
<deny users="*"/>
</authorization>
</system.web>
</location>The server has Service Pack 1 installed as well as:
KB article 922068
KB article 931186
KB article 937749
All Commerce Server 2007 Hotfix's
If I need to refresh the site from the main site not any of the services how? I have tried http as well as https://<siteName>.com/CatalogWebService/SiteCacheRefresh.axd?CacheToRefresh=CatalogCache
I even tried this with the services site.
Any suggestions?
- mike,
first of all, we need to find if you axd handler is working. You can find this by accessing you <appAddress>/SiteCacheRefresh.axd. If you get and exception, saying that you need to specify the CacheToRefresh param, your axd is working.
Pay atention to the correct address to try. If your web site is under mikedopp.com, but inside it you have a virtual directory to you CS2K7 app, you need to access using mikedopp.com/VirtualDirectory/SiteCacheRefresh.axd, ´cause you web.config is inside this virtual directory, so the configuration to this handler.
If you get an 404 http error here, the address you typed is incorrect or the your web.config don´t have the <add verb=".. to the SiteCacheRefresh.axd. But please, you need to access the SiteCacheRefresh.axd of the main app, not the services. All other SiteCacheRefresh.axd will try to access this one (and yes, their handler exist).
Second, if you found the correct address, you need to compare it to the one that is shown in the 404 error. After that we can try to figure out the real problem. Andre,
Let me get this right.
In a normal install of commerce server enterprise the SiteCacheRefresh.axd that is not created until you request it(because it is dynamic) should be called within the main site or application? If so where?
I only have a refresh button within the services ie(Customers and orders manager.) As I explained in my long list of configurations I have two separate sites both with independent IP address's. The Main Site does not have a virtual directory for the services (should this be the case?). The Second Site would be just the services site that hosts the 4 web services in virtual directories. So if you were to really look at how its configured you would see that the Main site is independent of the Services Sites by IP and by Host Headers.
So my answer to you unless I am completely missing something (This has been the case with things before) The only way to talk to the SiteCacheRefresh.axd on any of the sites would be through the Services.(AppAddress).com/SiteCacheRefresh.axd.... Now also notice that the DNS name Services.(AppAddress).com is also a registered DNS name. The reason for this is so that I can connect from a internally heavily Firewalled Corporate LAN to a Https address or Port 443 hole to a Collocated Server Half a planet away. The SiteCacheRefresh.axd should be called from this enviroment and the server should react accordingly. Yes I have checked the amount of Network hops and the lag time to make sure that all requests should be carried out without slow down due to my very expensive connections. This is besides the point.
I need to use the SiteCacheRefresh from the Services.(AppAddress).com (using HTTPS no less) to refresh a catalog. Once again if this is located in the main site, where do I call it?
At this point I am willing to have someone look at my config and tell me I am stupid via Shared Desktop. Please let me know if there are any takers to this challenge.
The config of my sites are again:
the Main app or Web Site:
http and https://www.<appName>.com with host headers www.<appName>.com Port 80 and 443 tied to a single IP with Registered DNS name(duh!) This is a seperate website without any virtual directories including services.
the Services apps or Web Site:
http and https://Services.<appName>.com with host headers Services.<appName>.com Port 80 and 443 tied to a single IP also registed DNS name as well as Host Header: <Server Name> port 80 tied to the same single IP as the services.
Under this site or app is 4 virtual directories for the services.
The 404 error is coming when I type (I am using research when doing this.) http://services.<appName>.com/YourFavoriteService/SiteCacheRefresh.axd
This goes for the https address of the above string.
I also get this when I do this:
http://services.<appName>.com/SiteCacheRefresh.axd
This goes for the https address of the above string.
I get the 404 when I do this:
http://www.<appName>.com/YourFavoriteService/SiteCacheRefresh.axd
This goes for the https address of the above string
I get the 404 when I do this:
http://www.<appName>.com/SiteCacheRefresh.axd
this goes for the https address of the above string
I added the virtual folders under the main site/app and now I get a mixed authenication error. Picture up shortly.
Hello Mike,
If you want to use the SiteCacheRefresh.axd in an IIS application, you must ensure it's in THIS application "web.config".
In your example, you try to go to the AXD under the CatalogWebService. By default, the CatalogWebService web.config has not this http handler, whereas the orders one has it.
So, just this url should work in your web browser with a standard install of CS :
http://<your domain>/<your OrdersWebService path>/SiteCacheRefresh.axd?CacheToRefresh=CatalogCache
And the same url with HTTPS, if you enable SSL on your OrdersWebService as written in the CS documentation.
So in all my confusion I was able to use the url http://<appName>/SiteCacheRefresh.axd?CacheToRefresh=CatalogCache
To get a 401 unauthorized. Any Ideas?
Thanks again.
mike,
probably this is an azman problem. You must configure the permissions at the authorization stores, using azman.msc.
Here is an example: http://msdn2.microsoft.com/en-us/library/aa545874.aspx
So I was able to get the sitecacherefresh to work outside the management tools. However I am not sure why they will not work inside the management tools. I still get a 404 error. Ideas?
I get a 401 on the server itself and it works outside the server. My permissions all messed up?
- Yes, it's just a matter of permission. Take the installation guide and check each step of the web service configuration and the SQL roles assignments.
mike,
take a look at the web.config file, maybe there´s a location tag for the SiteCacheRefresh.axd address. something like this:
<location path="SiteCacheRefresh.axd"><system.web>
<authorization>
<deny users="*"/>
</authorization>
</system.web>
</location>
The appPool user must be granted here.
