No IIS directly execute the problem encountered in the ASPX file

xiaoxiao2021-03-06  62

[C #] No IIS directly executes problems in the ASPX file

Try ApplicationHost in your own ACTIONSERVLET.DLL [C #]

Execute the ASPX file directly without IIS.

The result took two hours on a small problem!

My code is as follows:

Private static hostRequest m_host;

. . .

m_host = (HostRequest) ApplicationHost.createApplicationHost

Typeof (HostRequest),

"/ foo",

Directory.getcurrentDirectory ());

// Directory.getCurrentDirectory () is used to get the current run directory

Then place an ASPX file in this directory.

However, there is a thing.

I run the test program in a USINGASPRUNTIME project, which can create this ApplicationHost.

In other directories, they cannot be created! An abnormality system.io.filenotfoundexception occurs one here, and its error is:

"File or Assembly Name ActionServlet, or One of Its Dependencies, Was Not Found."

("Can't find a file or assembly name" ActionServlet ", or not find a dependency")

Before I figured out the principle, I was really dawn by this error, I want to see what is unusual, is it right? Is it related to cache? Is it related to Machine.config?

Finally, after reading hundreds of literature on Google News Group:

"You have to create a bin directory as subdirectory to your current directory and move a copy of ConsoleHost.exe to it Now you have two copies of ConsoleHost.exe, one in the current directory (in my case f:. / Temp / test /) And another in / bin (in My Case F: / Temp / Test / bin) Directory. "

It's really 醍醐 醍醐.

It turned out that under the physical path you tried to create, there must be a subfolder BIN, where your components on your run are depelled!

I put an actionServlet.dll, and everything is normal!

Hey, if you know the principle behind CreateApplicationHost, can I take two hours? !

Reference documentation:

http://www.csharphelp.com/archives/archive248.html

"Processing a .aspx file from console window, WITHOUT USING IISBY JAMSHEER E B"

转载请注明原文地址:https://www.9cbs.com/read-85287.html

New Post(0)