WebAPI returning 415 before it ever reaches a line of code in my controller...



  • How the hell do you debug such a thing?

    It happened when I changed the form submission to being a Multi-Part POST instead of a normal POST. That's usually a no-op-- there's no reason WebAPI should treat the POSTed data any differently, but it is... somehow... for some reason?

    This would be fine if I could debug the damned error, but it happens before any of my own code is executed.


  • SockDev

    415 is 'Unsupported media type', so check the request headers and your server config are correct.

    Oh, and it's not WebAPI returning 415, it's IIS (or whatever server you're using. Probably IIS).



  • @RaceProUK said:

    415 is 'Unsupported media type', so check the request headers and your server config are correct.

    That is the opposite of useful.

    Check WHERE? What settings? What does "correct" mean?


  • SockDev

    You're developing a web application, and you don't know how to check request headers or server config?



  • @RaceProUK said:

    You're developing a web application, and you don't know how to check request headers or server config?

    Of course I know how to check them. I'm looking at them right now.

    What I don't know is what to check them for.

    Look, stop being a dick. If you don't know the answer, just say, "I don't know." I already know you're wrong about one thing: it's entirely possible for WebAPI to return a 415 on its own, independent of IIS.


  • SockDev

    You have all the info you need to fix the problem; there is nothing more I can add.

    And no, I'm not going to give you a crash-course in HTTP.

    Maybe if you weren't allergic to Google, you wouldn't have even started this thread.


  • SockDev


  • Grade A Premium Asshole

    @blakeyrat said:

    Of course I know how to check them. I'm looking at them right now.

    What I don't know is what to check them for.

    This is basically the water heater debacle all over again. I suggest you call a repairman, because you are obviously not qualified to do the task you are attempting to do.

    I think you posted in the wrong place. You may want to try http://stackoverflow.com, another of Jeff's fine constructs.



  • @RaceProUK said:

    You have all the info you need to fix the problem; there is nothing more I can add.

    What settings in IIS can cause a 415 to be returned? That is a piece of information I do not have.

    @RaceProUK said:

    And no, I'm not going to give you a crash-course in HTTP.

    I know how HTTP works. I know what 415 means. What I do not know is:

    1. What part of my request is incorrect, so that it could cause a 415?
    2. What settings in IIS/WebAPI can return a 415 to a (normally) valid request?

    @RaceProUK said:

    Maybe if you weren't allergic to Google, you wouldn't have even started this thread.

    I started this thread after looking for the problem on Google; the solutions I found there do not apply to my situation.

    @accalia said:

    popcorn

    Fuck off you piece of shit. This is the serious part of the site, I'm asking for help.

    @Polygeekery said:

    This is basically the water heater debacle all over again. I suggest you call a repairman, because you are obviously not qualified to do the task you are attempting to do.

    Fuck off you piece of shit. This is the serious part of the site, I'm asking for help.


  • Grade A Premium Asshole

    @blakeyrat said:

    Fuck off you piece of shit. This is the serious part of the site, I'm asking for help to be spoon fed the answer, when I would trash talk anyone else who did the same.

    FTFY


  • SockDev

    @blakeyrat said:

    I know how HTTP works. I know what 415 means. What I do not know is:

    1. What part of my request is incorrect, so that it could cause a 415?
    2. What settings in IIS/WebAPI can return a 415 to a (normally) valid request?
    • Funnily enough, it might have something to do with the media type specified in the request. But then how can I tell? You haven't posted the request headers.
    • Just pulling this out of my arse, but maybe it's something to do with media types. But how can I tell? You haven't posted the server config.

    You know about MIME types, yes?



  • @RaceProUK said:

    1) Funnily enough, it might have something to do with the media type specified in the request. But then how can I tell? You haven't posted the request headers.

    They're fine.

    @RaceProUK said:

    2) Just pulling this out of my arse, but maybe it's something to do with media types. But how can I tell? You haven't posted the server config.

    They're fine.

    @RaceProUK said:

    You know about MIME types, yes?

    Yes. Now go away. Nothing you've said has helped even a tiny iota; you obviously have no fucking clue what you're talking about.


    The problem seems to be that WebAPI doesn't ship with a multipart/form-data formatter by default. I'm stumped as to why, but switching the request to use a Content-Type WebAPI does set a formatter for (for example, application/json) causes the request to enter my controller.

    So now the exercise is to either find or write a formatter for multipart/form-data


  • SockDev

    @blakeyrat said:

    Fuck off you piece of shit. This is the serious part of the site, I'm asking for help.

    asking for help is generally a lot more polite.

    we have next to no information about what request you are sending and what app is receiving it. it cannot be a surprise we have little to no help to provide.



  • @Polygeekery said:

    FTFY

    This is Coding Help. I wouldn't trash talk anybody who posted here. I would hope that nobody else would, either. But apparently I am wrong.


  • Grade A Premium Asshole

    @blakeyrat said:

    This is Coding Help. I wouldn't trash talk anybody who posted here. I would hope that nobody else would, either. But apparently I am wrong.

    Just you. I will leave you alone now. You are sufficiently rankled.


  • SockDev

    @blakeyrat said:

    Yes. Now go away. Nothing you've said has helped even a tiny iota; you obviously have no fucking clue what you're talking about.

    Right, so because you gave no info at all, I'm the one at fault.

    Y'know what, I'm sick of your shit. I try to help you, and you treat me like garbage. So next time you want help, just fuck off, because you won't get a damn thing from me.


  • Winner of the 2016 Presidential Election

    @blakeyrat said:

    It happened when I changed the form submission to being a Multi-Part POST instead of a normal POST. That's usually a no-op-- there's no reason WebAPI should treat the POSTed data any differently, but it is... somehow... for some reason?

    FWIW, I remember having an issue with JSPs and not being able to do the same stuff with a multipart/form-data vs a standard form post. Probably not helpful, but I think they're handled completely differently (Something like getParamater() stopped working, and us having to parse the stream with the multipart manually...) I don't know anything about WebAPI, but it might be the same issue.

    EDIT:
    @blakeyrat said:

    The problem seems to be that WebAPI doesn't ship with a multipart/form-data formatter by default. I'm stumped as to why, but switching the request to use a Content-Type WebAPI does set a formatter for (for example, application/json) causes the request to enter my controller.

    So now the exercise is to either find or write a formatter for multipart/form-data


    Yep, that's what we had to do



  • @RaceProUK said:

    Right, so because you gave no info at all, I'm the one at fault.

    1. if you can't help me, don't post at all. If you needed more information to help me, post and ask for it. You did neither.

    2. the first post does contain all the information you need to identify the problem, which is that WebAPI does not support multipart/form-data by default.

    3. you were DEAD WRONG when you said the error was returned by IIS, and led me in the wrong direction for a time.

    Now that I've narrowed down the problem here, I'm hoping this article will be useful in solving it:


  • Grade A Premium Asshole

    Now, just copy and paste that like a good little programmer.


  • SockDev

    @blakeyrat said:

    1) if you can't help me, don't post at all. If you needed more information to help me, post and ask for it. You did neither.

    @RaceProUK said:
    You haven't posted the request headers.

    @RaceProUK said:
    You haven't posted the server config.

    It's almost as if I wanted to see those things...


    @blakeyrat said:

    2) the first post does contain all the information you need to identify the problem, which is that WebAPI does not support multipart/form-data by default.

    You said you were getting a 415 from a multipart post, and that was all. That could have been anything from a missing WebAPI module/parser/thing to a spelling error in the header. But to know for sure, I would have needed to see the request headers. Which I (indirectly) asked for.


    I work with someone almost as obtuse as you; frequently, he would have a go at me for not providing enough info. So, you want to know how I dealt with that?

    I started providing more info.

    Funnily enough, he's been a lot nicer to me since.


  • Discourse touched me in a no-no place

    @blakeyrat said:

    This is the serious part of the site.

    It was until you got here, anyway.

    @blakeyrat said:

    I'm asking for help.

    Smart people are more polite to the people they want help from, if they don't want sabotaged help.


  • Grade A Premium Asshole

    @FrostCat said:

    Smart people are more polite to the people they want help from, if they don't want sabotaged help.

    Blakey is not a smart man...

    http://what.thedailywtf.com/t/do-none-of-the-baby-forum-newcomer-idiots-not-know-that-coding-help-is-an-actual-category-for-providing-help/7069/23?u=polygeekery


  • Discourse touched me in a no-no place

    @Polygeekery said:

    Blakey is not a smart man...

    Logically, that was implied.


  • Grade A Premium Asshole

    I know, but he likes being spoon fed.


  • Discourse touched me in a no-no place

    @Polygeekery said:

    I know, but he likes being spoon fed.

    I don't think he actually likes anything except puerile ranting.


  • Grade A Premium Asshole

    @FrostCat said:

    I don't think he actually likes anything except puerile ranting.

    This place is better than a "Word A Day" calendar for my vocabulary. <not all words are new, some I am just reminded of, but still helpful>



  • @blakeyrat said:

    The problem seems to be that WebAPI doesn't ship with a multipart/form-data formatter by default. I'm stumped as to why, but switching the request to use a Content-Type WebAPI does set a formatter for (for example, application/json) causes the request to enter my controller.

    That's weird since Microsoft has documentation for sending and processing multi-part form data in WebAPI 2.


  • Discourse touched me in a no-no place

    @Polygeekery said:

    This place is better than a "Word A Day" calendar for my vocabulary.

    You're welcome. :smile:


  • SockDev

    @Polygeekery said:

    This place is better than a "Word A Day" calendar for my vocabulary.

    indubitably. how fortuitous we're about the premises then!



  • Theirs works because it's not using WebAPI to automatically do mapping to a data object.

    That was actually a lot of the gap in my understanding. If you tell WebAPI to handle it without data mapping, it sends you the request even if it's a type it has no Formatter class for. If you ask it to auto-map to a model, it throws a 415. Go figure.



  • @FrostCat said:

    I don't think he actually likes anything except puerile ranting.

    Mac OS Classic.

    BOOOYAAAAH!


  • Discourse touched me in a no-no place

    @boomzilla said:

    Mac OS Classic.

    Yes, but Macs suck because of the whole one-button thing

    <!-- trolling, trolling, trolling, keep those dogies trolling, keep those dogies trolling, rawhide! -->


  • @FrostCat said:

    Yes, but Macs suck because of the whole one-button thing

    C#

    DOUBLE BOOOYEAAHHHH!



  • Is Mono for Mac Classic a thing yet?



  • @blakeyrat said:

    Fuck off you piece of shit. This is the serious part of the site, I'm asking for help.

    Why would you expect to get that via an abrasive, abusive, worthless Internet persona with a long track record of help allergy? If the actual human being behind the blakeyrat mask needs help, perhaps that actual human being should create a second account for the purpose of being taken >0.000000000000001% seriously.



  • @Polygeekery said:

    he likes being spoon fed

    He'd suckle if he could get away with it. Unfortunately the only skill he retains from that phase of his career is a solid grounding in how to suck.


  • Grade A Premium Asshole

    @flabdablet said:

    the only skill he retains from that phase of his career is a solid grounding in how to suck.

    Then you really would think he would have made it farther up the corporate ladder...



  • Frustrated by teeth


  • Grade A Premium Asshole

    @flabdablet said:

    Frustrated by teeth

    So, you are saying, it is more a matter of form than enthusiasm?



  • It's form over suction.


  • Grade A Premium Asshole

    @flabdablet said:

    It's form over suction.

    I see what you did there....


  • Discourse touched me in a no-no place

    @flabdablet said:

    If the actual human being behind the blakeyrat mask needs help, perhaps that actual human being should create a second account for the purpose of being taken >0.000000000000001% seriously.

    I wonder if the real human deserves the help, either, but I don't have to make that judgment call today.



  • Blakey reminds me of myself when I look for help online.
    It's not something I should admit to, and it ain't pretty to look at - but it's good for one's heart, I find.

    Not the best for getting answers, but one could make an argument that one's health is more important...



  • @FrostCat said:

    I wonder if the real human deserves the help, either

    If the real human behind blakey were half smart, whether or not he deserved it would not matter; he'd simply trade on the reasonable assumption of good faith that's the only thing that actually keeps people coming to these places to talk to each other. And as long as nobody doxxed him, then he'd get his help and be happy, and we'd give our help and be happy, and everybody would win.

    But if somebody did out his new sock puppet, it would not be long before the consequences of his old persona's consistently hostile attitude came home to roost.

    Blakey's human appears to labour under the misapprehension that sustained and consistent venom is funny. Well, maybe it could be, for a month or two. But the novelty corroded off this particular one a long, long time ago, and now it's merely one more shitty thing to make a shitty day shittier.

    Even taking the occasional swipe at it is getting old.

    @blakeyrat needs to retire.



  • @flabdablet said:

    Blakey's human appears to labour under the misapprehension that sustained and consistent venom is funny. Well, maybe it could be, for a month or two. But the novelty corroded off this particular one a long, long time ago, and now it's merely one more shitty thing to make a shitty day shittier.

    Even taking the occasional swipe at it is getting old.


    I only read this site and rarely post but I find him hilarious. It's like when a toddler gets super angry (often over nothing) and frowns and stamps their feet. The reaction is laughter, not dismay or offense. I don't get why so many folks treat him so seriously and get so offended by him. He's a silly bastard, that adds a lot of colour to the forum. In my opinion.

    Though of course, I also find it amusing how people give him shit when he actually needs help too. That's equally funny :smile_cat:



  • @KillaCoder said:

    It's like when a toddler gets super angry (often over nothing) and frowns and stamps their feet. The reaction is laughter, not dismay or offense.

    Toddlers grow up, and that is what makes their struggles funny; we recognize our own early struggles in theirs, and happily anticipate sharing our amusement with them when they're looking after toddlers of their own. Comparing @blakeyrat's formulaic industrial outrage to a toddler's is like comparing Potted Meat Food Product to steak, Cheez Whiz to cheese, or My Little Pony to drama.



  • Hmmm I wouldn't be quite on the same page as you there.

    I just enjoy seeing senseless, baseless, yet for some reason intense rage. The combination of how fierce it can be, compared to how little there is to be angry with in the first place, is what I find amusing. There's no deeper meaning for me, so maybe the toddler example was bad.

    Seeing Mr Blakey scream abuse at someone for posting a freaking GIF just makes me lol. It's so over the top, exaggerated, unnecessary. Makes me happy anyway, though perhaps I'm just a freak like that :)


  • BINNED

    You know who else was amused by rage? The Nazis! WWII was one giant troll.

    You monster


  • area_deu

    @KillaCoder said:

    scream abuse at someone for posting a freaking GIF

    The thing everyone did when @wood did it during the early discodays?



  • Yeah, it was super funny then too :smile:


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.