I am having all kinds of problems with the eBay .NET SDK (http://go.developer.ebay.com/developers/ebay/documentation-tools/sdks/dotnet)
Posted this question the other day:
HttpRuntime.Cache doesn't appear to be working
Now after a lot more investigation, it would seem that in fact calling the eBay API is clearing my .NET Session and Cache data, restarting the application in fact.
WHY?!!
The function which seems to be at fault is my method for grabbing eBay categories. The question above first came about because I was finding I was unable to cache the incredibly slow response I get from eBay... however, it seems I can cache it, but something in the function is causing the application to restart.
Here's how I get categories:
Shared Function DisplayCategories(Optional ParentId As Integer = 0, Optional Level As Integer = 1) As CategoryTypeCollection
Dim Categories As New CategoryTypeCollection
Dim apiContext As ApiContext = Credentials.GetApiContext()
Dim apicall As New GetCategoriesCall(apiContext) With {
.EnableCompression = True,
.Site = SiteCodeType.UK,
.LevelLimit = Level
}
If ParentId <> 0 Then _
apicall.CategoryParent = New StringCollection({"" & ParentId & ""})
apicall.DetailLevelList.Add(DetailLevelCodeType.ReturnAll)
'SiteCodeType.UK, New StringCollection({"1"}), 10, False
Categories = apicall.GetCategories()
Return Categories
End Function
All caching code removed for simplicity, but I can assure you, running this function clears my cache and any Session data.
Any idea why?!!
I think I have the solution to this now... (After two days and the answer is fairly simple too)
The reason was the eBay SDK was storing its api log file in the bin folder which, when edited, caused the application to restart. I added these lines of code to application_end in global.asax
I then inspected the shutDownMessage and it came back with:
"Change Notification for critical directories. bin dir change or directory rename HostingEnvironment initiated shutdown HostingEnvironment caused shutdown Change Notification for critical directories. bin dir change or directory rename"
I thin checked the bin folder and low and behold the eBayAPiLog.txt file was written there.
I have now changed the code that sets up the eBay Log file to store it in the application root instead.
With this change the application is no longer recycling and session and cache persist!