Windows 상자의 모노 및 XSP를 사용한 웹 페이지 샘플 웹 페이지
문제
나는 첫 번째 ASP.NET 웹 페이지를 Windows에서 사용하여 작동하도록하고 있습니다. 단핵증 그리고 XSP 웹 서버.
나는이 챕터를 따르고있다 예시. 그만큼 첫 번째 부분 그의 예는 최신 버전의 모노와 매우 잘 작동합니다. 그러나 웹 부분은 다음과 같은 오류로 넘어가는 것 같습니다.
'{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 버전을 시험해 보는 모노 전문가를 찾고 있다고 생각합니다.
해결책 3
이봐, 나는 "코드 뒤의 코드"를 얻는 방법을 모르겠지만 내가 만족하는 해결 방법을 찾았습니다. 다른 사람들의 이익을 위해 여기에 게시 할 것이라고 생각했습니다. 기본적으로 코드를 메인 페이지로 옮기고 사용하는 것만으로도 훌륭하게 작동합니다.
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를 시작하기 위해 사용하는 명령 줄을 붙여 넣을 수 있습니까? 단일 웹 app을 실행하는 경우 이와 같은 것이 실제로 필요하지 않으며 문제의 원인이 될 수 있습니다.
xsp -applications /simplewebapp : c : projects mono aspexample
ASPEXALLE 디렉토리에 CD 만하고 매개 변수가없는 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 (비 보안)을 강타하여 서버를 중지합니다.
프로젝트를 탐색하려고 할 때
CS 파일이 유효한 가상 경로가 아니라는 IE 신음 전과 동일한 출력을 얻습니다.
ASPX 페이지의 SRC 속성이 문제라고 생각합니다. 아마도 새로운 버전의 모노에서 업데이트되었을 것입니다. 나는 그것을 조사 할 것이다.
답장 주셔서 감사합니다 btw.
데이브
XSP 대신 XSP2를 실행해 보셨습니까?