简体   繁体   中英

How does IIS register/find the DLLs in the /bin folder?

I have a static HTML website running under IIS. I need to have one path that does something executable (sends an email). I figured I'd write a simple handler.

I have configured my web.config with this:

<add name="Emailer" verb="*" path="sendemail" type="Emailer, Emailer.dll" />

Then I wrote an HttpHandler and compiled to a DLL called Emailer.dll.

Then I naively just created a /bin folder in the root and dropped my DLL into it.

I get the error:

Could not load file or assembly 'Emailers.dll' or one of its dependencies.

So, IIS sees my handler registration and dutifully attempts to find it, but it's "blind" to the DLL in the /bin folder I created.

So, what makes the /bin folder...magic? I just created a folder at the root of the website, assuming whatever was in it would be visible to IIS. Evidently, I was wrong.

How do I get IIS to look in a folder I created for assemblies?

(Note that this was not an ASP.Net website originally. Normally, when writing an ASP.Net website, I start from Visual Studio, which I'm assuming bootstraps a lot of stuff with web.config settings. But this was an empty IIS site to which I just added a "web.config" and "/bin" folder.)

My problem is that you don't need the "dll" in the handler element. Just "Emailer." It adds the "dll" automatically.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM