omenMedlem sedan dec. 200136 inlägg Får det inte å funka när den ska visa min servers uptime.
Använder denna koden:
<script language="c#" runat="server">
void Page_Load()
{
TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
ltlUptime.Text = "The Web server has been running for:<br>" +
ts.Days.ToString() + " days, " +
ts.Hours.ToString() + " hours, and " +
ts.Minutes.ToString() + " minutes.";
}
</script>
<asp:literal id="ltlUptime" runat="server" />
Men får detta felmess när jag ska testa sidan:
Error Type:
Active Server Pages, ASP 0129 (0x80004005)
The scripting language 'c#' is not found on the server.
/test/index.asp, line 6
Min serverdator kör Win2k Adv Server med .NET Framework + SP2.
Nån som vet varför det inte funkar?
JosefMedlem sedan mars 20023 561 inlägg Re: Uptime
omen skrev:
Error Type:
Active Server Pages, ASP 0129 (0x80004005)
The scripting language 'c#' is not found on the server.
/test/index.asp, line 6
Har du provat att ändra filnamnet till .aspx?
omenMedlem sedan dec. 200136 inlägg Bytt till .aspx nu
Men då kommer detta upp:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: path2
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: path2]
System.IO.Path.Combine(String path1, String path2) +419
System.Web.FilePathParse..ctor(String path, Boolean isFile, Boolean getShortNames) +366
System.Web.FileChangesMonitor.StartMonitoringDirectoryRenamesAndBinDirectory(String dir, FileChangeEventHandler callback) +46
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +324
[HttpException (0x80004005): ASP.NET Initialization Error]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +927
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +128
:l
BrimbaMedlem sedan dec. 19995 875 inlägg Såhär skulle du kunna göra:
<script language="c#" runat="server">
void [b]Page_Load(Object source, EventArgs e)[/b]
{
TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
ltlUptime.Text = "The Web server has been running for:<br>" +
ts.Days.ToString() + " days, " +
ts.Hours.ToString() + " hours, and " +
ts.Minutes.ToString() + " minutes.";
}
</script>
<asp:literal id="ltlUptime" runat="server" />
omenMedlem sedan dec. 200136 inlägg Får samma fel där
Har jag gjort nåt annat fel kanske.
Hur ska hela koden se ut om jag bara ska ha en tom vit sida där det står min uptime.
Behöver jag bara denna koden:
<script language="c#" runat="server">
void Page_Load(Object source, EventArgs e)
{
TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
ltlUptime.Text = "The Web server has been running for:<br>" +
ts.Days.ToString() + " days, " +
ts.Hours.ToString() + " hours, and " +
ts.Minutes.ToString() + " minutes.";
}
</script>
<asp:literal id="ltlUptime" runat="server" />
Eller måste det va nån annan kod me???
BrimbaMedlem sedan dec. 19995 875 inlägg Föjande sida: http://forum.brimba.nu/uptime.aspx
innehåller följande kod:
<script language="c#" runat="server">
void Page_Load(Object source, EventArgs e)
{
TimeSpan ts = TimeSpan.FromMilliseconds(Environment.TickCount);
ltlUptime.Text = "The Web server has been running for:<br>" +
ts.Days.ToString() + " days, " +
ts.Hours.ToString() + " hours, and " +
ts.Minutes.ToString() + " minutes.";
}
</script>
<asp:literal id="ltlUptime" runat="server" />
omenMedlem sedan dec. 200136 inlägg Min uptime.aspx ser EXAKT likadan ut.
Men får fortfarande samma fel :(
Server Error in '/' Application.
--------------------------------------------------------------------------------
Value cannot be null. Parameter name: path2
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: path2
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentNullException: Value cannot be null.
Parameter name: path2]
System.IO.Path.Combine(String path1, String path2) +419
System.Web.FilePathParse..ctor(String path, Boolean isFile, Boolean getShortNames) +366
System.Web.FileChangesMonitor.StartMonitoringDirectoryRenamesAndBinDirectory(String dir, FileChangeEventHandler callback) +46
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +324
[HttpException (0x80004005): ASP.NET Initialization Error]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +927
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +128
:( :( :(
BrimbaMedlem sedan dec. 19995 875 inlägg Sker det på fler sidor? Har du kollat din machine.config/web.config osv?
omenMedlem sedan dec. 200136 inlägg
Brimba skrev:
Sker det på fler sidor? Har du kollat din machine.config/web.config osv?
Fattar inte nåt av machine.config och web.config =/
Jag har bara en aspx sida och den funkar inte.
Alla vanliga asp sidor funkar perfekt.
nikoMedlem sedan juni 20022 599 inlägg omenMedlem sedan dec. 200136 inlägg Tack!!
Nu funkar det!!
J---a Microsoft! :e