How to debug an ISAPI Filter? - isapi

ISAPI Filters are dll's that get attached to the w3wp process of IIS web server. ISAPI Filters have to compulsorily export two functions viz. HttpFilterProc and GetFilterVersion. I have written one such filter but it is not working in the way that the switch case in HttpFilterProc is not getting activated. What can i do to check whats wrong here ?

Add a call to DebugBreak in your HttpFilterProc and build your DLL in debug mode before adding it as ISAPI filter.
If your HttpFilterProc gets called, windows would popup a message to debug the process.
If it doesn't your DLL is not getting loaded. You need to check why it is not. Some reasons may be:
The ISAPI filter is configured with different bitness as compared to the application pool bitness.
You have not registered for any ISAPI events in your GetFilterVersion function. See list of ISAPI events here.

Related

PhoneProductId in appxmanifest: Upgrade from Silverlight to Runtime vs. Map Service Application Id (wp RT 8.1)

I'm updating an app from Windows Phone Silverlight 8.1 to WP Runtime 8.1 and got an issue with the "PhoneProductId" in the Package.appxmanifest:
1) Either I provide the Id from the old Silverlight version of the app. Then I can update it in the console via "AppDeployCmd.exe" /targetdevice:de /update MyApp_1.2.3.4_AnyCPU.appxbundle" with no user data being lost. But when I run MapRouteFinder.GetDrivingRouteAsync(...) I get an InvalidCredentials-error, since I haven't provided the proper Map Service Application Id, which in RT needs to replace the PhoneProductId (in Silverlight, it needed to be provided via c#, alongside the Authentication Token).
2) Or I provide the Map Service Application Id and can use MapRouteFinder.GetDrivingRouteAsync properly. But then I can neither /update the app (error message "Application is not installed" in the console) because of different PhoneProductIds in the two app versions. I also can't /install it without first uninstalling it ("Could not register package").
Anybody got a way out of this dilemma?
I've now uploaded soulution number 2 to the store, with GetDrivingRouteAsync working before the upload. The update did work, without any user data being lost, so no problem here.
However, when using the version from the store, GetDrivingRouteAsync is again not working (same problem as in solution number 1).
Seems to be exactly the same issue as this one:
https://stackoverflow.com/questions/32891052/invalid-credentials-with-getdrivingrouteasync-only-when-i-create-packages-for-st

Disable Session.checkAgent for one action

I have built a controller that is uses the media view to stream videos to users. When someone accesses the controller from an iOS device, the user agent being sent is not matching and the session logs out.
I am using the iPad plugin for Flow Player and I have seen other posts about flash not sending the correct user agent strings, so instead of messing with that, I'd like to disable Session.checkAgent for that specific action. I have tried adding it to beforeFilter(), but the check clearly happens before that point.
Is there some other method I can override to implement this?
I haven't tested it, but if you know (part of) the URL, you can check the $_GET['url'] inside your app/Config/core.php and modify the session configuration based upon its value, For example, $_GET['url'] starts with '/videos/view'.
You need to do this inside the configuration file, otherwise the session is already started as you already discovered.
Note that $_GET['url'] is only used in older versions of CakePHP. For newer versions of CakePHP, you may need to user $_SERVER['REQUEST_URI'] or another $_SERVER environment variable.

Sharepoint 2013 - 404 Not Found while accessing site collection from outside

This question may be a dublicate, but no recent post leads to a working answer for my case.
I have a Sharepoint 2013 running on a Windows Server 2012. Following issue appeared:
I made a new Site-Collection as wiki. Everything (links,...) works fine on the server but when I want to access the wiki from outside (not localhost) the server runs in a 404 Not found error.
http://localhost/sites/wiki/Pages/Home.aspx - works fine(localhost)
http://10.38.0.15/sites/wiki/Pages/Home.aspx - doesn't work.
I checked the IIS settings, all servers are up and running. The log file has no errors in it.
Does anyone know, how to solve this problem?
thx
Jürgen
The most common cause for this is that you don't have the IIS host header configured correctly. The 404 will appear because you are hitting a different IIS web site and not the one you intended to.
If you go into IIS Manager and click on "Sites" in the right hand pane there will be a column called bindings and a column called ID.
IIS will check in the order of ID for the first site that matches. Make sure the default site is stopped. If you see bindings that look like the following:
ID 1: Bindings: *:80
ID 2: Bindings: www.yoursite.com:80
www.othersite.com will match ID 1. Any other site that doesn't specify a port or https: will be directed to ID 2. You need to ensure that the site you are trying to access matches your bindings. The "www.yoursite.com" is added to the site via "New Web Application" in SharePoint. There is a field called Host: in Central Administration. This should match what you are typing from inside and outside the server. If you need the site to respond to multiple names, you need to extend the web application.
Assuming you used the default of claims authentication, here are the instructions for that:
http://technet.microsoft.com/en-us/library/gg276325.aspx
I am not sure if this is still required in Server 2012, but disabling the loopback check might also help, although this usually results in a 401, and repeated attempts to log in. Here are the instructions for that.
http://support.microsoft.com/kb/896861
Сheck the alternate access mapping in SharePoint administrator.
It should be something like this:
http://yourservername default
http://10.10.1.30:80 internet
http:// so on ..

Silverlight web service call not even hitting servers

I have a custom proxy class for a single WCF web-service (takes a string in, sends a string back). The asynchronous web service call works great from my Windows Form app. However, when I call it from a test Silverlight app I get an error: Hresult 0x80000012. This error is for Extension Attributes on files I believe... Go figure.
Using Fiddler I can confirm that no traffic is making it to IIS which is hosting the service, so it isn't the usual cross-domain restriction issue. I've tried using both "localhost" (which works in the Windows Forms app) and a name defined in my hosts file just in case "localhost" was causing the problem.
I've tested it by making the async call from the UI thread and also from a thread-pool queue item with the same results.
The proxy code is basically just simplified down from what the MS proxy generator creates, setting up bindings and settings programatically instead of via config files, and I use basically the same source to compile normal .Net and Silverlight versions of the libraries involved. (Now, the MS proxy code it is based on is from a WCF web service, not from the RIA template code, so maybe there are differences there...)
Four days of fruitless search on this one. Any help or suggestions would be wildly appreciated!
Figured it out. I was using (stupidly) a backslash in part of the URL that I used to set up the service call. Most of the interior parts of the MS code handled that ok and transposed them to forward slashes -- on Windows Forms everything worked seamlessly in fact. However, the Silverlight libraries couldn't handle it and threw the very helpful "HResult 0x80000012" error.
Changing my backslashes to slashes seems to have fixed the problem!

Unit Testing the Server Interface for a Silverlight-Facebook Application

I have a Silverlight 4 client running on a Facebook page hosted on Google App Engine. It's using gminifb to communicate with the Facebook API. The Silverlight client uses POST calls to the URIs for each method and passes the session information from Facebook with each call.
The project's growing and it would be super-useful if I could set up a unit-testing system to make a variety of the server calls so that when I make changes I can ensure everything else still works. I've worked with nUnit before and I like what I've read of PEX but I'm not sure how to apply them to this situation.
What're the choices for creating a test system for this? Pros/cons of each?
How do I get started setting something like this up?
Solved. I did it as follows:
Created a special user account to be used for testing on the server that bypassed the authentication. Only did this on the test environment by checking a debug flag in that environment's settings. This avoided creating any security hole in the live site (since the same debug flag will be false there.)
Created a C#.NET solution to test each API call. The host project is a console app (no need for a GUI) with three reusable synchronous methods:
SendFormRequest(WebRequest request, Dictionary<string,string> pairs),
GetJsonFromResponse(HttpWebResponse response),
and ResetAccount().
These three methods allow the host project to make HTTP requests on the server and to read the JSON responses.
Wrapped each server API call inside a method call in the host project.
Created an nUnit test project in the solution. Then simply created tests that call each wrapper method in the host project, using different parameters and changing values on the server.
Created a series of tests to verify correct error handling for invalid parameters and data.
It's working perfectly and has already identified a few minor issues that have been found. The result is immensely useful and will check for breaking changes on new deployments.

Resources