开发者

Referencing code in App_Code from web.config

I have a type in my App_Code folder from a Web Site project that I want to refer to in Web.config. The type attribute is requiring me to put in an assembly name. The internets is failing me with what to put in for the assembly.

Specifically in,

<system.web>
    <webServices>
        <soapExtensionReflectorTypes>
            <add type="MyType, $App_Code$" />
        </soap开发者_Python百科ExtensionReflectorTypes>
    </webServices>
</system.web>

What do I put in $App_Code$ to make it compile? I've tried _ _ code, App _code, App _Code (Markdown is failing here: those type names don't have spaces in them)


OK, I found the answer on some obscure MSDN forum: you can't do that in a Web Site project for system.web/webservices/soapExtensionReflectorTypes. Only a Web Application Project will suffice.


I found a work around for a Web Site project. I moved the type out of the App_Code folder and put it in a new class library, compiled and added to the bin directory.

Now the web.config section finds the type through

<soapExtensionReflectorTypes>
    <add type="MyNamespace.MyType, FileTitleOfLibrary"/>
</soapExtensionReflectorTypes>

The second argument is the filename of the library without the file extension.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜