Question

J'essaie de faire fonctionner ma première page Web ASP.NET sur Windows avec Mono et le serveur Web XSP.

Je suis cet exemple chaps. La la première partie de son exemple fonctionne très bien avec la dernière version de mono. cependant, la partie Web semble basculer avec l'erreur suivante

  

'{Nom du chemin} \ Index.aspx.cs' n'est pas un   chemin virtuel valide.

Voici la trace de pile complète:

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] 

Je me demandais si quelqu'un savait ce que cette erreur signifiait. Je suppose que je recherche un expert mono qui a essayé la version Windows.

Était-ce utile?

La solution 3

Hé, je ne sais pas comment obtenir le & code; code derrière " ça marche mais j'ai trouvé une solution de contournement qui me satisfait. Je pensais le poster ici pour le bénéfice des autres. Fondamentalement, vous déplacez le code derrière dans la page principale et cela fonctionne très bien en utilisant le

Commande XSD et aucun paramètre.

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

Autres conseils

Pouvez-vous coller la ligne de commande que vous utilisez pour démarrer xsp? Si vous exécutez une seule application Web, une telle chose n'est pas vraiment nécessaire et pourrait en être la source:

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

cd au répertoire ASPExample et exécutez xsp sans paramètre.

La commande que j'utilisais était la suivante:

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

J'ai juste essayé de lancer XSP sans aucun paramètre et j'obtiens le résultat suivant:

  

xsp2 Ecoute à l'adresse: 0.0.0.0   Répertoire racine:   C: \ Projects \ Mono \ ASPExample Listening   sur le port: 8080 (non sécurisé) Hit Return   arrêter le serveur.

Lorsque j'essaie de naviguer dans le projet

http: // localhost: 8080

Je reçois le même résultat qu'avant I.e. gémissant que le fichier cs n’est pas un chemin virtuel valide.

Je pense que l’attribut src de la page ASPX est le problème. Peut-être qu'il a été mis à jour dans la nouvelle version de Mono. Je vais examiner cela.

Merci pour votre réponse, BTW.

Dave

Avez-vous essayé d'exécuter xsp2 plutôt que xsp?

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top