Maybe it’s not their fault but then again, they built the server (IIS) and the Web tech (ASP.NET). This had me scratching my head for a few minutes until I just happened to figure it out by mistake.
I was doing an Ajax call to an aspx page with a Web Method. Something like this:
/someplace/somefile.aspx/MyWebMethod
Using JSON and JQuery. Fine. Done it a ton of times throughout the site but this time it was in a specific folder that contained files used exclusively for Ajax calls (mostly XML).
The error I was getting was:
Exception information:
Exception type: ArgumentException
Exception message: Unknown web method DoLookup.
Parameter name: methodName
Unknown web method, huh? But, the file was there, the code was in there and it worked fine on Dev…what the deuce?
After trolling the net to find something (mostly found people forgetting “static” or making their WebMethods private), the idea that the file might be corrupt popped into my head.
I thought I was stupid…after all, the aspx file just contains a basic page reference to the code behind. All the real action was in the site dll. It’d be stupid if–
Then I saw it. The file size was ZERO. Nice. I checked the delivery folder (where I drop deployments onto the server). Also zero. Great.
Checked my dev publish folder where said deployments start their life after a publish from within Visual Studio. 1kb. Oooo…looks like something died in between.
So, I copied that sucker all over again and lo and behold, the friggin thing works!
I dunno, I guess you’ve got to ask yourself what you’d do if you were trying to figure out an error message for that…how’s about Page reference missing? Or Holy Shit, your aspx file has NO CONTENT.
Ugh…Microsoft…love/hate is becoming hate/hate…
So, I’d just merged some code into my test build to prepare a deployment to staging when I got a compilation error on a page stating that a “}” was expected and referencing a line in a temp file from the GAC that included a line like this:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
I’m scratching my head…wtf? I searched for the above and found a reference in the strings resource I had for the site. But, there weren’t any problems with the code…in fact, the site compiled just fine! More scratching…then I searched online. Found this. Different error but the same or rather a similar stack trace.
Then I thought about it. Missing closing bracket…well, we’d just modified some code recently that involved what I’m sure Microsoft would rather we didn’t do…in the front-end aspx file we did something like this:
<% if (something == true) { %>
<myfancyhtml></myfancyhtml>
<% }//end if %>
And, lo and behold, the recent merge managed to include two copies of the opening line with a single closing line. Lovely.
Anyhow, in case you run into this wonderfully obscure error, check your <% %> tags if the code behinds still compile successfully…probably have something in there that’s causing you problems…no need to reboot and all that crap.
kn