I have a web site that I want to add an ApiController to that will handle an Ajax call from one of the web pages. There isn't much to the controller but I'm very confused about how to either add the controller to the existing web.config so that it will run
or how to add the project to the current web site. Another issue is that the current web site is using .NET 4.0. I think the controller uses some of the more recent packages.
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Sorry to be such a boob but if I'd found the standard documentation any help, I wouldn't have asked the question here. Recommendations out side of read the documents would be greatly appreciated.
Part of my issue is that my controller has to be added to the current web site because I am making an Ajax call from a standard HTML web page and Ajax calls outside the same location are blocked or problematic.
I'm very sorry but I'm trying to follow the documents you linked to but the project was originally created in an earlier version of Visual Studio. I'm using VS 2013. The current solution is all using .NET 4.0. When I try to add the attributes, I can't find
the references they are in to load them. Many of the asseblies that are used in my original proof of concept are in 4.5.
What I'd like to do is just add a handler for a get that takes a value and returns a JSON response to one of the page's JavaScript. I thought I knew how to do this back when I was using VS 2010 but so much has changed.
The original site must be on way too old of a version. There is not a GlobalConfiguration and a lot of the other classes described in your links. They simply don't exist in that version. What would I look at for much earleir versions?
Sorry to be such a boob but if I'd found the standard documentation any help, I wouldn't have asked the question here. Recommendations out side of read the documents would be greatly appreciated.
Generally it's recommended to check whether you use ApiController properly, and we could give troubleshooting further, so I give the MSDN document above.
In addition, if this issue is related to .NET frameworks versions, you could give more details to troubleshoot.
Best regards
Angie
asp.netapicontroller
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
5 Posts
How do I add an ApiController based site to an existing web site?
Mar 24, 2014 03:12 PM|TeamFugu|LINK
I have a web site that I want to add an ApiController to that will handle an Ajax call from one of the web pages. There isn't much to the controller but I'm very confused about how to either add the controller to the existing web.config so that it will run or how to add the project to the current web site. Another issue is that the current web site is using .NET 4.0. I think the controller uses some of the more recent packages.
asp.net apicontroller
All-Star
32817 Points
3815 Posts
Re: How do I add an ApiController based site to an existing web site?
Mar 24, 2014 11:02 PM|Angie xu - MSFT|LINK
Hi,
Please take a look at configuring ASP.NET Web API, and check whether it helps on this issue.
# Configuring ASP.NET Web API
http://www.asp.net/web-api/overview/extensibility/configuring-aspnet-web-api
Moreover, this is also available for us to use ApiController Class,
# ApiController Class
http://msdn.microsoft.com/en-us/library/system.web.http.apicontroller(v=vs.118).aspx
If you have any concern, please let me know.
Regards
asp.net apicontroller
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
None
0 Points
5 Posts
Re: How do I add an ApiController based site to an existing web site?
Mar 25, 2014 10:21 AM|TeamFugu|LINK
Sorry to be such a boob but if I'd found the standard documentation any help, I wouldn't have asked the question here. Recommendations out side of read the documents would be greatly appreciated.
Part of my issue is that my controller has to be added to the current web site because I am making an Ajax call from a standard HTML web page and Ajax calls outside the same location are blocked or problematic.
asp.net apicontroller
None
0 Points
5 Posts
Re: How do I add an ApiController based site to an existing web site?
Mar 25, 2014 12:24 PM|TeamFugu|LINK
I'm very sorry but I'm trying to follow the documents you linked to but the project was originally created in an earlier version of Visual Studio. I'm using VS 2013. The current solution is all using .NET 4.0. When I try to add the attributes, I can't find the references they are in to load them. Many of the asseblies that are used in my original proof of concept are in 4.5.
What I'd like to do is just add a handler for a get that takes a value and returns a JSON response to one of the page's JavaScript. I thought I knew how to do this back when I was using VS 2010 but so much has changed.
asp.net apicontroller
None
0 Points
5 Posts
Re: How do I add an ApiController based site to an existing web site?
Mar 26, 2014 05:07 PM|TeamFugu|LINK
The original site must be on way too old of a version. There is not a GlobalConfiguration and a lot of the other classes described in your links. They simply don't exist in that version. What would I look at for much earleir versions?
asp.net apicontroller
All-Star
32817 Points
3815 Posts
Re: How do I add an ApiController based site to an existing web site?
Mar 26, 2014 10:52 PM|Angie xu - MSFT|LINK
Hi,
Appreciate your feedback.
Generally it's recommended to check whether you use ApiController properly, and we could give troubleshooting further, so I give the MSDN document above.
For your issue, I think this example is also avialable to learn the procedure to use ApiController: How to add Web API to an existing ASP.NET MVC 4 Web Application project
In addition, if this issue is related to .NET frameworks versions, you could give more details to troubleshoot.
Best regards
Angie
asp.net apicontroller
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.