I build an ASP.Net WebApi project with mono in Linux.
When I start (Debug/Release) the Application within Monodevelop. The application runs without errors. Example : I start a (Debug/Release) session. Then I navigate to 127.0.0.1:9000/api/person/ . Then I receive the expected xml output.
However, when I execute the xsp4 server from within the "bin" directory. The application starts fine, but when I go to 127.0.0.1:9000/api/person/ . I'm ending with the following exception:
Description: HTTP 404.The resource you are looking for (or one of its dependencies)
could have been removed, had its name changed, or is temporarily unavailable. Please
review the following URL and make sure that it is spelled correctly.
Details: Requested URL: /api/person/
Exception stack trace:
at System.Web.StaticFileHandler.ProcessRequest (System.Web.HttpContext context) [0x00000] in <filename unknown>:0
at System.Web.DefaultHttpHandler.BeginProcessRequest (System.Web.HttpContext context, System.AsyncCallback callback, System.Object state) [0x00000] in <filename unknown>:0
at System.Web.HttpApplication+ <Pipeline>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
at System.Web.HttpApplication.Tick () [0x00000] in <filename unknown>:0
Im using :
Question:
In addition: I didn't noticed this problem until i tried to deploy the app to appharbor.
xsp4
is supposed to be run from the web application directory, not from bin
directory.
The reason is in the ASP.NET architecture: a web application consist of a main directory ( say webapp
) and several standard directories.
Let's just focus on bin
, which only contains compiled assemblies referenced by your web application.
Simply said, if you run xsp4
under the scope of the bin
directory, it'll never be able to reference Index.aspx
. On the other hand, running Index.aspx
from webapp allows the server to load any required assembly from the bin
directory