Saturday, March 31, 2012

Web Config conflict?

I have 2 ASP.NET (C#) applications (A and B) running on the same
server (IIS6, but the problems is also present in IIS5).

Each application has its own Web.Config file. The only difference
between the web config files is the following

<system.web>
<httpHandlers>
<add verb="GET" path="cachedimageservice.axd"
type="MsdnMag.CachedImageService,DynamicImage" />
</httpHandlers>
</system.web
When I run application A, which does not contain the above handler, I
get an error: "File or assembly name DynamicImage, or one of its
dependencies, was not found."

It is as if the handler declaration is machine wide and not limited to
application B. What is going on?

Finally, if I add the DynamicImage.dll to application A's bin
directory the error goes away... Application A does NOT make use of
this dll

Any clues?application a must have a reference to the dll. when the page is compiled
(first hit) the compiler will need the dll to complete the compile.

-- bruce (sqlwork.com)

"Alberto" <albertoconti@.gmail.com> wrote in message
news:7062a4c9.0412021418.6e40ad84@.posting.google.c om...
| I have 2 ASP.NET (C#) applications (A and B) running on the same
| server (IIS6, but the problems is also present in IIS5).
|
| Each application has its own Web.Config file. The only difference
| between the web config files is the following
|
| <system.web>
| <httpHandlers>
| <add verb="GET" path="cachedimageservice.axd"
| type="MsdnMag.CachedImageService,DynamicImage" />
| </httpHandlers>
| </system.web>
|
| When I run application A, which does not contain the above handler, I
| get an error: "File or assembly name DynamicImage, or one of its
| dependencies, was not found."
|
| It is as if the handler declaration is machine wide and not limited to
| application B. What is going on?
|
| Finally, if I add the DynamicImage.dll to application A's bin
| directory the error goes away... Application A does NOT make use of
| this dll
|
| Any clues?
Check to see if Application A's directory is declared,
in IIS, as an IIS Virtual Directory or as an IIS Application.

Also, if you could post what the physical
directory structure looks like, it would help
pin down the problem.

Is it:

/root/A/B

or
/root/B/A

or
/root
/A
/B

i.e., is either B or A a subdirectory of the other one,
or are both subdirectories of the root directory ?

Juan T. Llibre
===========
"Alberto" <albertoconti@.gmail.com> wrote in message
news:7062a4c9.0412021418.6e40ad84@.posting.google.c om...
> I have 2 ASP.NET (C#) applications (A and B) running on the same
> server (IIS6, but the problems is also present in IIS5).
> Each application has its own Web.Config file. The only difference
> between the web config files is the following
> <system.web>
> <httpHandlers>
> <add verb="GET" path="cachedimageservice.axd"
> type="MsdnMag.CachedImageService,DynamicImage" />
> </httpHandlers>
> </system.web>
> When I run application A, which does not contain the above handler, I
> get an error: "File or assembly name DynamicImage, or one of its
> dependencies, was not found."
> It is as if the handler declaration is machine wide and not limited to
> application B. What is going on?
> Finally, if I add the DynamicImage.dll to application A's bin
> directory the error goes away... Application A does NOT make use of
> this dll
> Any clues?
"Alberto" <albertoconti@.gmail.com> wrote in message
news:7062a4c9.0412021418.6e40ad84@.posting.google.c om...
>I have 2 ASP.NET (C#) applications (A and B) running on the same
> server (IIS6, but the problems is also present in IIS5).
> Each application has its own Web.Config file. The only difference
> between the web config files is the following
> <system.web>
> <httpHandlers>
> <add verb="GET" path="cachedimageservice.axd"
> type="MsdnMag.CachedImageService,DynamicImage" />
> </httpHandlers>
> </system.web>
> When I run application A, which does not contain the above handler, I
> get an error: "File or assembly name DynamicImage, or one of its
> dependencies, was not found."
> It is as if the handler declaration is machine wide and not limited to
> application B. What is going on?
> Finally, if I add the DynamicImage.dll to application A's bin
> directory the error goes away... Application A does NOT make use of
> this dll
> Any clues?
"Alberto" <albertoconti@.gmail.com> wrote in message
news:7062a4c9.0412021418.6e40ad84@.posting.google.c om...
>I have 2 ASP.NET (C#) applications (A and B) running on the same
> server (IIS6, but the problems is also present in IIS5).
> Each application has its own Web.Config file. The only difference
> between the web config files is the following
> <system.web>
> <httpHandlers>
> <add verb="GET" path="cachedimageservice.axd"
> type="MsdnMag.CachedImageService,DynamicImage" />
> </httpHandlers>
> </system.web>
> When I run application A, which does not contain the above handler, I
> get an error: "File or assembly name DynamicImage, or one of its
> dependencies, was not found."
> It is as if the handler declaration is machine wide and not limited to
> application B. What is going on?
> Finally, if I add the DynamicImage.dll to application A's bin
> directory the error goes away... Application A does NOT make use of
> this dll
> Any clues?

Is Application A under application B virtually? If so, then this is a known
bug, and you've already found the workaround - put the DLL into the bin
folder of application A. You can then use <remove> in the application A
web.config to get rid of the handler.

John Saunders
I think I have solved the problem...

As I mentioned I had 2 applications A and B. However, application A
was the default application when you reached http://site -->
http://site/A. Application B was reachable from a link in application
A or from http://B

Looking at IIS Manager at http://site one sees A and B as a virtual
directory under it... so apparently I was wrong!

In any case, I did the following which solved the problem.
I added a file default.aspx at http://site which contains a simple
<%Response.Redirect("A")%>. Each application then has its own
webconfig file.

Is this the best way to do this?

Thanks
Alberto

"Juan T. Llibre [MVP]" <nomailreplies@.nowhere.com> wrote in message news:<eKG73RV2EHA.1300@.TK2MSFTNGP14.phx.gbl>...
> What's happening is that neither of your
> config files in A *or* B are executing.
> If you make A an IIS virtual directory,
> the web.config in /A will execute.
> If you make B an IIS virtual directory,
> the web.config in /B will execute.
> Right now, both A and B are running either off of the
> web.config in /root, if there is one, or off of machine.config.
> Try either...and let us know.
>
> Juan T. Llibre
> ===========
> "Alberto" <albertoconti@.gmail.com> wrote in message
> news:7062a4c9.0412030636.b114179@.posting.google.co m...
> > Thanks for your replies, but I think I am still really puzzled.
> > The structure of the dir is
> > /root
> > /A
> > /B
> > and neither A not B are virtual directories. So how can this happen?

0 comments:

Post a Comment