ASP.net assembly locating

D

Dugan Zhang

Previously I was building websites using asp. I have a folder name
"projects", under the projects folder, I have number of subfolders,
each subfolder represent a website I'm building. Inside each
subfolder, I would have varies files for that website such as asp,
images.

This works fine for asp websites, all I have to is create one virtural
directory in IIS for the projects folder and I can access each
websites that I'm building by "/projects/folder name"

Now, I switching to ASP.NET, I would have to create a virtual
directory for each of the subfolder under the projects folder,
otherwise it will not able to find the assemblies for the website.

Is there any way to get around that? I was thinking of using
AssemblyResolve event in the global.asax file to dynamically load the
assemblies, but this doesn't seems to work.
 
W

Wiktor Zychla

Now, I switching to ASP.NET, I would have to create a virtual
directory for each of the subfolder under the projects folder,
otherwise it will not able to find the assemblies for the website.

just put all the binaries in the main folder's \bin subfolder. they should
be accessible from any subdirectory of the main application's directory. I
think that this is a general rule : asp.net searches for assemblies only in
\bin subfolder of the application's main folder.

Wiktor Zychla
 
S

Scott Allen

Dugan:

You'll face an uphill battle trying to load assemblies from outside
the bin subdirectory of a web app, I'd try to avoid the complications.

Having said that, as long as all the assemblies you need are in a
subdirectory (private assemblies) - you can add a probing path to
web.config. For example, this would pull an assembly from a
sub-application's bin dir:

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="SubApplication/bin" />
</assemblyBinding>
</runtime>
<configuration>
 
D

dugan_zhang

I have look at configuration for probing, but that only seems to work
for non asp.net application. For asp.net website, it seems to ignore
the privatepath and only look for the assemblies in bin directory.
 
D

dugan_zhang

You can see the exampe at http://69.199.167.164/projects/test2/

test2 is folder under the projects folder, in test2, I have the
web.config file set as following

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="test2\bin"/>
</assemblyBinding>
</runtime>
</configuration>

I have try several different privatePath, such as /test2/bin,
test2\\bin, but none of them work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top