开发者

problem importing class from bin file asp.net vb.net virtual directory

开发者 https://www.devze.com 2023-03-17 14:37 出处:网络
the problem i met is that i have iis 7 running on my pc. in the root file, wwwroot, i have a website folder, namely [apex] which is a virtual directory. in the folder is a bin folder containing a comp

the problem i met is that i have iis 7 running on my pc. in the root file, wwwroot, i have a website folder, namely [apex] which is a virtual directory. in the folder is a bin folder containing a compiled class with namespace.

then in an aspx file, i tried to import the namespace and use the class inside the namespace.


    <%@ import namespace="namespacexxx">
    <script language="vb" runat="server">
  开发者_运维百科  sub pgld() handles me.load
    dim sds as new the_class
    end sub
    </script>

the namespace and classname has been checked well, no mistake. but at compiling stage, i got "type is not defined " message.

ok,then, in iis 7 control panel, i convert the whole website folder from "virtual directory" to "application" type. the problem goes away!!

any idea what's happening?


In IIS 6 the concept of a virtual dir was a bit different. In IIS7 if it's a virtual directory you are not using the files from that folder to compiled the app, instead from the root websites executable folder. So - your 'app' in IIS 7 needs to be an 'application' in order to compile and search the bin folder for those resources - othewise its just a virtual directory which is some path on the URL that points to "some path" on the disk. Those folders can have their own web.config but their binaries are not processed as you would expect as a 'separate application' - the code is compiled into the parent sites binaries.


I guess you did not add the Reference of that particular ddl in the website. You need to add the reference in your website before using.

Right Click Website properties --> Click Add Reference
0

精彩评论

暂无评论...
验证码 换一张
取 消