views:

161

answers:

2
+1  Q: 

Remote Codebase

I have a dll. That dll is uploaded on a server. I want that each time the application starts to get the "latest" dll from the server, so I've used the following code in my app.config. Why isn't it working?

here is the app.config file:

<configuration>
<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
            <assemblyIdentity name="ReflectionTest"
            publicKeyToken="f94c9b9f0707ee96"
                culture="neutral" />
            <codeBase version="1.0.0.0"                   
                href="http://127.0.0.1/ReflectionTest.dll"/&gt;
        </dependentAssembly>
    </assemblyBinding>
</runtime>
</configuration>
A: 

Is your .dll actually available at that location? Are you serving it up through some web application?

If you type that URL into a web browser, does it let you download or open that file?

womp
Yes, it's available. Is an Apache server, I host there my websites
Timotei Dolean
+1  A: 

First, you may be on the wrong track. Even if you didn't change the version, your application may end up using an older copy of the assembly.

Assuming a valid URI in your <codebase> element, when your application runs for the first time, the runtime will not find the assembly in until it probes your codebase. Then, it will download the assembly to the GAC. When your application runs again, the runtime will find that assembly in the GAC, so it will not need to probe for it.

Instead of using <codebase>, consider using Reflection. Specifically, you might want to use Assembly.LoadFrom(assemblyUri) in your application, getting the URI from an application setting. From there, you'd create objects using the Reflection API, particularly using Activator.CreateInstance<T>().

As for getting that assembly from your server is concerned, make sure that your DLL is in the right location and that your web server is running and properly configured.