473,511 Members | 14,981 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET runtime hosting problem

Hi all,

For some reasons I need host ASP.NET, in the network I found such code:

using System;
using System.IO;
using System.Web;
using System.Web.Hosting;
using System.Reflection;
using System.Diagnostics;
using System.Globalization;

public class Asmx2WsdlHost : MarshalByRefObject
{
public void ProcessRequest(String page)
{
HttpWorkerRequest hwr = new SimpleWorkerRequest(
page,
"WSDL",
Console.Out);

HttpRuntime.ProcessRequest(hwr);
}
}

public class App
{
public static Asmx2WsdlHost CreateApplicationHost(
string virtualDir,
string physicalDir)
{
string appName = "ASPHOST";
string appId = (virtualDir + physicalDir).GetHashCode().ToString("x");
string aspDir = HttpRuntime.AspInstallDirectory;
string domainId = "ASPHOST_" +
DateTime.Now.ToString().GetHashCode().ToString("x" );
AppDomainSetup setup = new AppDomainSetup();
setup.ApplicationName = appName;
setup.ConfigurationFile = "web.config";
setup.ApplicationBase = physicalDir;

AppDomain loDomain = AppDomain.CreateDomain(domainId, null, setup);
loDomain.SetData(".appDomain", "*");
loDomain.SetData(".appId", appId);
loDomain.SetData(".appPath", physicalDir);
loDomain.SetData(".appVPath", virtualDir);
loDomain.SetData(".domainId", domainId);
loDomain.SetData(".hostingVirtualPath", virtualDir);
loDomain.SetData(".hostingInstallDir", aspDir);

return (Asmx2WsdlHost)loDomain.CreateInstance(
typeof(Asmx2WsdlHost).Assembly.FullName,
typeof(Asmx2WsdlHost).FullName).Unwrap();
}

public static int Main(string[] args)
{
try
{
Asmx2WsdlHost host = CreateApplicationHost(
@"/ASPHOST",
@"D:\PROJECTS\BIN");

host.ProcessRequest(@"CatiBridge.asmx");
}
catch (Exception e)
{
Trace.TraceError(e.ToString());
return 1;
}

return 0;
}
}

But, it throws exception:[HttpException]: The path '/App_GlobalResources/'
maps to a directory outside this application, which is not supported.
at
System.Web.Compilation.CodeDirectoryCompiler.GetCo deDirectoryAssembly(VirtualPath
virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet
excludedSubdirectories, Boolean isDirectoryAllowed)
at System.Web.Compilation.BuildManager.CompileCodeDir ectory(VirtualPath
virtualDir, CodeDirectoryType dirType, String assemblyName, StringSet
excludedSubdirectories)
at System.Web.Compilation.BuildManager.EnsureTopLevel FilesCompiled()
[HttpException]: The path '/App_GlobalResources/' maps to a directory
outside this application, which is not supported.
at System.Web.Compilation.BuildManager.ReportTopLevel CompilationException()
at System.Web.Compilation.BuildManager.EnsureTopLevel FilesCompiled()
at System.Web.Compilation.BuildManager.GetGlobalAsaxT ypeInternal()
at System.Web.HttpApplicationFactory.CompileApplicati on()
at System.Web.HttpApplicationFactory.Init()
at System.Web.HttpApplicationFactory.EnsureInited()
at System.Web.HttpApplicationFactory.GetApplicationIn stance(HttpContext
context)
at System.Web.HttpRuntime.ProcessRequestInternal(Http WorkerRequest wr)
I have no idea why and how to fix it :( Please help if somebody know:

PS:
.NET Version v2.0.50727

Thanks a lot!
Nov 12 '07 #1
0 824

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3577
by: Mathew | last post by:
Hi How do you specfiy the version of the .net runtime libraries loaded for a ..net controls hosted in Internet Explorer 6? I have a control that's designed to work with .NET 1.1, but after...
9
2971
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
8
2008
by: Rick Strahl [MVP] | last post by:
Hi all, I'm building an app that uses the ASP.Net runtime... One problem I've run into is that pages running inside of the runtime are not finding DLLs in the GAC. In fact, if I look at the...
7
1232
by: Andy Lim | last post by:
hi all, one of my asp.net appl was once runs smoothly. then the hosting i use move the server to somewhere else. after the move, the same appl returns runtime error. but without any clue what...
5
278
by: Kiyomi | last post by:
Hello, I have created two different ASP.NET applications and placed one in the root and another one in a sub-directory. http://localhost/MyApp_1/Index.aspx
1
12189
by: james.cssa | last post by:
When I try to compile the following program on Visual Studio 2005 Pro, the namespace System.Runtime.Remoting.Channels.Tcp is not recongized by the compiler. (The "Tcp" part is highlighted.) And I...
1
5210
by: steve | last post by:
Hi All I am using VB.net 2005 professional I have Picture Boxes which I fill with graphics (fillrectangle) I need to provide mouse resizing at runtime (Like in the IDE) Can someone point...
28
2550
by: sturlamolden | last post by:
On Monday Microsoft announced a new runtime for dynamic languages, which they call "DLR". It sits on top of the conventional .NET runtime (CLR) and provides services for dynamically typed...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7417
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.