在窗口框中使用Mono和XSP的示例网页

问题描述:

我试图让我的第一个ASP.NET网页在使用Mono和XSP Web服务器的窗口上工作。在窗口框中使用Mono和XSP的示例网页

我正在关注这个章节example。他的例子中的first part与单声道的最新版本非常吻合。但网络部分似乎翻倒了以下错误

'{Path Name} \ Index.aspx.cs'不是 有效的虚拟路径。

下面是完整的堆栈跟踪:

System.Web.HttpException: 'C:\Projects\Mono\ASPExample\simpleapp\index.aspx.cs' is not a valid virtual path. 
    at System.Web.HttpRequest.MapPath (System.String virtualPath, System.String baseVirtualDir, Boolean allowCrossAppMapping) [0x00000] 
    at System.Web.HttpRequest.MapPath (System.String virtualPath) [0x00000] 
    at System.Web.Compilation.BuildManager.AddToCache (System.String virtualPath, System.Web.Compilation.BuildProvider bp) [0x00000] 
    at System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000] 
    at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000] 
    at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath (System.String virtualPath, System.Type requiredBaseType) [0x00000] 
    at System.Web.UI.PageParser.GetCompiledPageInstance (System.String virtualPath, System.String inputFile, System.Web.HttpContext context) [0x00000] 
    at System.Web.UI.PageHandlerFactory.GetHandler (System.Web.HttpContext context, System.String requestType, System.String url, System.String path) [0x00000] 
    at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context, System.String url, Boolean ignoreContextHandler) [0x00000] 
    at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context, System.String url) [0x00000] 
    at System.Web.HttpApplication+<Pipeline>c__Iterator5.MoveNext() [0x00000] 

,如果有人知道什么意思这个错误我想知道。我想我正在寻找一名单声道专家,他尝试了Windows版本。

嘿,我不知道如何得到的东西的工作,但我已经找到了一个解决办法,我很高兴与“背后的代码”。我想我会把它放在这里为别人着想。基本上,您将代码移动到主页面中,只需使用XSD命令并且不使用参数即可使用

<%@ Page Language="C#" %> 
<%@ Import Namespace="System.Data" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    <head> 
    <title>Code behind Arrrrrrrrrrgh</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 

    <script runat="server"> 
    private void Page_Load(Object sender, EventArgs e) 
    { 
     DisplayServerDetails(); 
     DisplayRequestDetails(); 

    } 

    private void DisplayServerDetails() 
     { 
     serverName.Text = Environment.MachineName; 
     operatingSystem.Text = Environment.OSVersion.Platform.ToString(); 
     operatingSystemVersion.Text = Environment.OSVersion.Version.ToString(); 
     } 

     private void DisplayRequestDetails() 
     { 
     requestedPage.Text = Request.Url.AbsolutePath; 
     requestIP.Text = Request.UserHostAddress; 
     requestUA.Text = Request.UserAgent; 
     } 

    </script> 

    </head> 

    <body> 
    <form method="post" runat="server"> 
     <table width="450px" border="1px"> 
      <tr> 
       <td colspan="2"><strong>Server Details</strong></td> 
      </tr> 
      <tr> 
       <td>Server Name:</td> 
       <td> 
        <asp:Label id="serverName" runat="server"></asp:Label></td> 
      </tr> 
      <tr> 
       <td>Operating System:</td> 
       <td> 
        <asp:Label id="operatingSystem" runat="server"></asp:Label> 
       </td> 
      </tr> 
      <tr> 
       <td>Operating System Version:</td> 
       <td> 
        <asp:Label id="operatingSystemVersion" runat="server"> 
        </asp:Label> 
       </td> 
      </tr> 
     </table> 
     <br> 
     <table width="450px" border="1px"> 
      <tr> 
       <td colspan="2"><strong>Request Details</strong></td> 
      </tr> 
      <tr> 
       <td>Page Requested:</td> 
       <td> 
        <asp:Label id="requestedPage" runat="server"></asp:Label> 
       </td> 
      </tr> 
      <tr> 
       <td>Request From:</td> 
       <td> 
        <asp:Label id="requestIP" runat="server"></asp:Label> 
       </td> 
      </tr> 
      <tr> 
       <td>User Agent:</td> 
       <td> 
        <asp:Label id="requestUA" runat="server"></asp:Label> 
       </td> 
      </tr> 
     </table> 
     </form> 
    </body> 

你可以粘贴你用来启动xsp的命令行吗?如果你是刚刚运行的是不是真的需要一个Web应用程序是这样的,而且可能是问题的根源:

XSP --applications/SimpleWebApp:C:\项目\单声道\ ASPExample \

只需切换到ASPExample目录并运行不带参数的xsp。

我用的命令是这样的:

@echo off 
call C:\PROGRA~1\MONO-2~1.1\bin\setmonopath.bat 
xsp --root . --port 8088 --applications /:. 

我想只是运行不带参数XSP,我得到下面的输出:

xsp2上的地址听力:0.0.0.0 根目录: C:\ Projects \ Mono \ ASPExample聆听 端口:8080(非安全)点击返回 停止服务器。

当我尝试浏览到该项目上

http://localhost:8080

我得到了相同的输出,即前呻吟cs文件不是一个有效的虚拟路径。

我在想ASPX页面的src属性是问题所在。也许它已经在新版本的Mono中更新了。我将研究这一点。

感谢您的回复顺便说一句。

戴夫

您是否尝试过运行xsp2而不是xsp?