Pregunta

Estoy intentando que mi primera página web ASP.NET funcione en Windows usando Mono y el servidor web XSP.

Estoy siguiendo este capítulo ejemplo . La primera parte de su ejemplo funciona muy bien con la última versión de mono. sin embargo, el elemento web parece caerse con el siguiente error

  

'{Nombre de ruta} \ Index.aspx.cs' no es un   ruta virtual válida.

Aquí está el seguimiento completo de la pila:

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] 

Me preguntaba si alguien sabía qué significaba este error. Supongo que estoy buscando un experto mono, que ha probado la versión de Windows.

¿Fue útil?

Solución 3

Oye, no sé cómo obtener el " código detrás de " todo funciona pero he encontrado una solución con la que estoy contento. Pensé en publicarlo aquí para beneficio de los demás. Básicamente, mueves el código a la página principal y funciona muy bien simplemente usando

Comando XSD y sin parámetros.

<%@ 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>

Otros consejos

¿Puede pegar la línea de comando que está utilizando para iniciar xsp? Si solo está ejecutando una sola aplicación web, algo como esto no es realmente necesario, y podría ser la fuente del problema:

xsp --applications / SimpleWebApp: C: \ Projects \ Mono \ ASPExample \

simplemente cd al directorio ASPExample y ejecute xsp sin parámetros.

El comando que estaba usando era este:

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

Intenté ejecutar XSP sin parámetros y obtengo el siguiente resultado:

  

xsp2 Escuchando en la dirección: 0.0.0.0   Directorio raíz:   C: \ Proyectos \ Mono \ ASPExample Listening   en el puerto: 8080 (no seguro) Hit Return   para detener el servidor.

Cuando intento buscar el proyecto en

http: // localhost: 8080

Obtengo el mismo resultado que antes I.e. quejándose de que el archivo cs no es una ruta virtual válida.

Estoy pensando que el atributo src de la página ASPX es el problema. Quizás se haya actualizado en la nueva versión de Mono. Voy a investigar eso.

Gracias por su respuesta, por cierto.

Dave

¿Has intentado ejecutar xsp2 en lugar de xsp?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top