<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Self-Host a Web API</title><link>http://asp.net</link><pubDate>Thu, 07 Mar 2013 15:05:26 GMT</pubDate><generator>umbraco</generator><description>Comments for Self-Host a Web API</description><language>en</language><atom:link href="http://asp.net/rss/comments/36893" rel="self" type="application/rss+xml" /><item><title>Comment Posted by win32nipuh</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Sun, 26 Feb 2012 04:02:34 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000014945</guid><description><![CDATA[ <p>Thnx for the sample. </p><p></p><p>One note:</p><p>using (HttpSelfHostServer server = new HttpSelfHostServer(config))</p><p></p><p>There is an error because  HttpSelfHostServer is not System.IDIsposable...</p><p></p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/win32nipuh.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by win32nipuh</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Sun, 26 Feb 2012 04:40:42 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000014946</guid><description><![CDATA[ <p>also, I have an exception here. How I can fix it?</p><p> </p><p>// here is exception: &#39;System.TypeLoadException</p><p>            using (HttpSelfHostServer server = new HttpSelfHostServer(config))</p><p>            {</p><p>                server.OpenAsync().Wait();</p><p>            </p><p>              </p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/win32nipuh.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by AmunRA81</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Tue, 13 Mar 2012 12:10:34 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015109</guid><description><![CDATA[ <p>Because i didn&#39;t find any way to host controllers from other assembly id did a verry little hack to expose this functionality:</p><p></p><p>I overrided the DefaultHttpControllerFactory, and only another line of code in Mike&#39;s snippet.</p><p></p><p>I don&#39;t know where to post this code.. tell me if you guys, if are u interested about it</p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/AmunRA81.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by robertmazzo</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Fri, 16 Mar 2012 15:00:05 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015139</guid><description><![CDATA[ <p>I cannot find the &quot;webapi.selfhost&quot; package (neither in VS10 nor in VS11 Beta). </p><p>In fact, I can&#39;t even see the NuGet Lib Mngr following these instructions:</p><p></p><p>From the Tools menu, select Library Package Manager, and then select Manage NuGet Packages for Solution. </p><p>Note: If do you not see this menu item, make sure that NuGet Package Manager installed correctly.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/robertmazzo.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jonhenning</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Thu, 22 Mar 2012 12:31:52 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015181</guid><description><![CDATA[ <p>Your route is missing the action.  Since your controller actually has two methods, you get an error.  Route should be:  </p><p></p><p>            config.Routes.MapHttpRoute(</p><p>                &quot;API Default&quot;, &quot;api/{controller}/{action}/{id}&quot;,</p><p>                new { id = RouteParameter.Optional });</p><p></p><p></p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/jonhenning.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jonhenning</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Thu, 22 Mar 2012 14:21:24 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015182</guid><description><![CDATA[ <p>Actually, my note about the action was incorrect.  I hadn&#39;t factored in the url that was to be expected to be testing</p><p>http://localhost:8080/api/products</p><p></p><p>I was trying </p><p>http://localhost:8080/api/products/GetAllProducts</p><p>which yielded an error where the &quot;id&quot; GetAllProducts was trying to be cast as an int.</p><p></p><p>Sorry for confusion.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/jonhenning.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by lunaverse</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Fri, 30 Mar 2012 11:10:41 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015225</guid><description><![CDATA[ <p>IoC?  Self host complains that my controller has no default c-tor.  If course not.  That&#39;s what this is for:</p><p></p><p>GlobalConfiguration.Configuration.ServiceResolver.SetResolver(new StructureMapDependencyResolver(container));</p><p></p><p>Seems to fail.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/lunaverse.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by lunaverse</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Fri, 30 Mar 2012 11:13:35 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015226</guid><description><![CDATA[ <p>How do we handle aspects like errors and logging?  In IIS hosted you do like this...</p><p></p><p>   GlobalFilters.Filters.Add(new HandleErrorAttribute());</p><p></p><p>But that&#39;s in the MVC assembly, and when you reference MVC everything else falls apart.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/lunaverse.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by lunaverse</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Fri, 30 Mar 2012 11:49:54 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015227</guid><description><![CDATA[ <p>I found answers to my questions.  Like this:</p><p></p><p>config.ServiceResolver.SetResolver(resolver);</p><p>config.Filters.Add(new ExceptionFilter());</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/lunaverse.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by billjam54</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Thu, 19 Apr 2012 12:10:40 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015364</guid><description><![CDATA[ <p> I have a WCF RestFul app I started and then went to Web API. Getting clients Windows Identity work fine with  that but for the web api version, it just returns the credentials used by the server. Is this something that got missed in Self Hosting ? Searches don&#39;t pop up with others having same problem so probably something I&#39;m doing wrong. I am using VS2 2010 and ASP.Net MVC 4 Web Api.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/billjam54.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by sxavier</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Wed, 16 May 2012 08:40:18 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000015517</guid><description><![CDATA[ <p>I receive a build error in the following code</p><p></p><p>config.Routes.MapHttpRoute(</p><p>                &quot;API Default&quot;, &quot;api/{controller}/{id}&quot;,</p><p>                new { id = RouteParameter.Optional });</p><p></p><p>Exception is given below.</p><p></p><p>The type &#39;System.Web.Routing.RouteCollection&#39; is defined in an assembly that is not referenced. You must add a reference to assembly &#39;System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&#39;.</p><p></p><p>How Can I resolve this?</p><p></p><p>Best regards</p><p>Sebastian</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/sxavier.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by Lupienok</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Wed, 01 Aug 2012 04:17:05 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016084</guid><description><![CDATA[ <p>Just a question. Although Web API has evolved from ASP.NET, why should it bear the words ASP and Web. It has got little to do with Active-Server-Page, yes, they can use it, but at the same time I am writing desktop client (WPF,AIR) and mobile clients (AIR for Android and iPhone) to make use of this new and beautiful technology. Other can utilise this directly in their pure HTML pages using JavaS async calls. How about the name &quot;Microsoft HTTP API&quot;. Isn&#39;t this what it actually is. Just a thought.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/Lupienok.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by jose luis latorre</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Sun, 26 Aug 2012 19:08:40 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016293</guid><description><![CDATA[ <p>Hi Sebastian,</p><p></p><p>regarding the error you got, </p><p>&quot;The type &#39;System.Web.Routing.RouteCollection&#39; is defined in an assembly that is not referenced. You must add a reference to assembly &#39;System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&#39;.&quot;</p><p></p><p>it is easy, just add a reference to System.WebRouting.dll and you are done.</p><p></p><p>Best,</p><p>Jose</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/jose%20luis%20latorre.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by garydean</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Wed, 12 Sep 2012 12:58:25 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016427</guid><description><![CDATA[ <p>Console app hosting is interesting but I host my websites in IIS7.  I see no tutorials for that kind of deployment i.e. exactly what files have to be moved to an asp.net website to make the web.api work there.  Hosting in IIS seems to me to be an awkward void in your tutorials.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/garydean.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by rajeshkalis</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Wed, 31 Oct 2012 07:34:06 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000016711</guid><description><![CDATA[ <p>How to call a web api method which returns JsonResult instead of regular objects or HttpResponseMessage.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/rajeshkalis.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by victorwoo</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Fri, 25 Jan 2013 10:17:17 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018248</guid><description><![CDATA[ <p>What&#39;s the difference of Microsoft.AspNet.WebApi.SelfHost and owin (&lt;a rel=&quot;nofollow&quot; target=&quot;_new&quot; href=&quot;https://github.com/owin/owin&quot; target=&quot;_blank&quot;&gt;https://github.com/owin/owin&lt;/a&gt;)</p><p>How to make a choice?</p><p>Thanks.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/victorwoo.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by JavaLSU</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Tue, 05 Feb 2013 14:44:12 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018348</guid><description><![CDATA[ <p>Will a self-hosted web api at port :8080 conflict if more than one winrt app has self-hosting apis with the same port?</p>]]></description><enclosure length="0" type="image/png" url="http://i3.asp.net/avatar/JavaLSU.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by fredzhu</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Thu, 21 Feb 2013 06:03:59 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018481</guid><description><![CDATA[ <p>How can I create routeTemplate in self-host web api like http://localhost:8080/api/mycontroller/GetProduct.json?id=1</p><p>I failed to use &quot;api/{controller}/{action}.{ext}/id&quot; . For MVC4, it&#39;s OK, for Self-Host, fails. Why? And Then how?</p><p>Thanks a lot.</p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/fredzhu.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by fredzhu</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Thu, 21 Feb 2013 06:08:02 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018482</guid><description><![CDATA[ <p>TO jose luis latorre:</p><p>You need to add reference &quot;System.web&quot;, it&#39;s not here by default. </p>]]></description><enclosure length="0" type="image/png" url="http://i2.asp.net/avatar/fredzhu.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item><item><title>Comment Posted by TeaMaster</title><link>http://asp.net/web-api/overview/hosting-aspnet-web-api/self-host-a-web-api</link><pubDate>Thu, 07 Mar 2013 15:05:26 GMT</pubDate><guid isPermaLink="false">00000000-0000-0000-0000000018605</guid><description><![CDATA[ <p>is there&#39;s a way to rename a property?</p><p></p><p>I would think something like this:</p><p></p><p>        [Display(Name = &quot;SessionKey&quot;)]</p><p>        public string WEBKEY { get; set; }</p><p></p><p>but it&#39;s not working I only get webkey in the response.</p>]]></description><enclosure length="0" type="image/png" url="http://i1.asp.net/avatar/TeaMaster.jpg?forceidenticon=false&amp;dt=635072782800000000&amp;enableAvatar=False&amp;cdn_id=2013-05-10-001" /></item></channel></rss>