简体   繁体   中英

Unable to refer to contents of dll file

I have a C# website running in IIS. I need to consume a web service in my aspx page. I created a proxy class using the command wsdl.exe and generated a dll for it. I copied the dll under bin directory but I am unable to refer to the proxy class from my .aspx.cs file.

I get an error:

CS0246: The type or namespace name 'TestSearchProxy' could not be found (are you missing a using directive or an assembly reference?)"

I tried adding the assembly reference in web.config using the following syntax:

<add assembly="TestSearchProxy, Version=0.0.0.0, Culture=neutral" />

I am unable to get the PublicKeyToken for the dll since the dll is not strongly typed.

I still get the above mentioned error even after adding the assembly. I need to make the changes directly to the website in IIS and cant make the changes in Visual studio.

Please help me out with this issue.

I am finally able to solve this issue. Here is a very useful link I found after lot of searching. http://www.sitepoint.com/net-web-services-5-steps-3/

Here is the key points I learnt with this excercise

If the dll is directly added under /bin directory then the assembly reference need not be added to web.config

One silly mistake I was doing was I was declaring the class using the same name as the proxy class file name. The class name was TestSearch and the proxy file name was TestSearchProxy. I blame my Java background for this anyways. :)

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