What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

Is it possible to expose a single action in my controller as a webservice?

  1. I couldn't find a suitable duplicate
  2. To demonstrate effort, the OP posted some broken code that is not salvageable.
  3. The real question is "how do I do it?"

How do we handle questions like this? It's completely uninteresting in its present form, but if we stripped out the code and made it a canonical question, it might be useful to others.

Does the community think there is a more productive way to handle questions like this, other than just closing them outright?

share|improve this question
4  
Is the question really unanswerable? (Note that I have no idea about C# MVC, but judging from the title the question itself could be interesting, if only to give an answer that says, "Don't do it like that, but do this: …") –  slhck Oct 5 '13 at 17:02
2  
Whatever you do "its not working"... –  ben is uǝq backwards Oct 5 '13 at 17:04
    
@slhck: The problem I have is the code... It's there to demonstrate effort, but it's useless to us, him or anyone else. It's part of the larger problem of us insisting on code, pulling these questions into troubleshooting mode and making them useless for anyone else encountering the question. –  Robert Harvey Oct 5 '13 at 17:04
    
@benisuǝqbackwards: The first question in that list is a perfect example. That looks like great information to know, but nobody's ever going to find it in a Google search. –  Robert Harvey Oct 5 '13 at 17:08
3  
@RobertHarvey Well, I'm not experienced in that domain, but of the code is just completely off then it has served it's purpose of giving you an indication of where the OP is at and what his problem is. If it turns out that where he's at is the very beginning, and that an answer would require explaining an entire concept from scratch, then perhaps "too broad" would apply? If you could explain the entire concept in a reasonably scoped answer though, then just answering it sounds acceptable. –  Servy Oct 5 '13 at 17:08
    
Well, but if you tell the OP that their code is useless (and why), then I'd say that's still a perfect answer to a question that could help others in the same situation. –  slhck Oct 5 '13 at 17:09
    
I supposed you could also close as "must describe the specific problem" –  Servy Oct 5 '13 at 17:09
3  
@Servy: The code is more than just broken... It is filler. Filler to demonstrate effort. "I got this far... Now what?" Well, now you need to start over. –  Robert Harvey Oct 5 '13 at 17:10
    
@RobertHarvey As for finding it in google, keep in mind that answers are also providing lots of content for google to index. If a good answer is filled with keywords/terms likely to be searched, the whole page becomes reasonably discoverable. –  Servy Oct 5 '13 at 17:11
    
There are hundreds (and thousands) of well written (and interesting) questions that don't have code to demonstrate effort (even recent ones). If the code makes that question worse, I'd say remove it and trying to rewrite the question enough to stand on its own without the code. –  psubsee2003 Oct 5 '13 at 17:11
1  
@RobertHarvey K, I couldn't tell that. If it's really completely unrelated to the actual problem then it should just be removed. Taking any old unrelated code (even if it's from the same project) and sticking it in a question isn't helping anyone. –  Servy Oct 5 '13 at 17:12
    
Alright. I think I've got my mind around it now. Thanks. –  Robert Harvey Oct 5 '13 at 17:14
1  
Or another idea would be to write your own question and self answer to be the canonical post, and close this as a dup of that –  psubsee2003 Oct 5 '13 at 17:14
1  
@AsheeshR: As you wish. Discuss away, preferably in an answer. –  Robert Harvey Oct 5 '13 at 17:35
3  
And that's the problem @robert, the only reason I didn't vote to.close the question you link is because you think it has some merit. "Not working" has become a synonym for "debug this", which is useless to everyone. I'd much rather questions with only a tiny snippet of code where the OP has thought about it. One could argue that the insistence on a display of effort is at fault. I'm not sure what the solution is, all I know is that the deluge is getting sorta boring... –  ben is uǝq backwards Oct 5 '13 at 18:53
show 2 more comments

1 Answer

Probably by not actioning them if the domain isn't understood.

I work a lot with ASP.NET MVC, and the code included by the OP helps to show their problem. Although ASP.NET MVC is very popular, it is still not one of the "top" tags and as such it can be hard to find experts in a timely fashion who can edit the post, or to find documentation.

The reason this question is asked is because the newer versions of ASP.NET MVC talk a lot about Web API which is basically the new catch phrase. However, it is a small abstraction. The main difference is the type of data which is returned. The OP from the closed question was merely trying to figure out how to use Web API without having the new version of code available.

What it breaks down to in this scenario is using a JsonResult type for the return. This in essence is the difference between the new Web API controllers and a classic controller.

I do not see the post as lacking "minimal" (what is minimal defined as anyway?) understanding, and it is definitely answerable (in my opinion) in its current form.

I will say that the closing is understandable though. The question is very poorly worded and barely avoids fitting the "here is what I want, code it for me" scenario.

share|improve this answer
3  
Well, I actually do understand ASP.NET MVC, although it's been awhile. There's no debugging that needs to take place here; the OP just needs to write some code that works (or have someone like you write it for him). There shouldn't be an escape hatch for folks who post some half-assed code in the hope that it demonstrates some effort. –  Robert Harvey Oct 5 '13 at 19:37
    
@RobertHarvey - I know you do :) I was trying to make my answer at least a little generic. I think this case is border line, but to address this exact example - it is answerable with a short piece of code that is not implementation specific and could help others who want to do web api without upgrading to the newest version. I am torn. The mvc-3 tag doesn't show up very often either, so I guess I am a little biased as well because I like to see what people are grappling with. –  Travis J Oct 5 '13 at 19:40
    
@RobertHarvey - I can honestly see both sides though. Is it appropriate for the community to provide code examples to users who lack a fundamental understanding of some small detail between point A and B? –  Travis J Oct 5 '13 at 19:44
    
Presumably, such small details could be made available to them in an answer, if the OP's code is otherwise good. –  Robert Harvey Oct 5 '13 at 19:49
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .