none
Assembly Redirection RRS feed

  • Question

  • I would appreciate all the help I can get on this issue. Maybe I am misunderstanding redirection so any clarification on that would also be appreciated if it seems to you that I have misunderstood the concept.

    I have a project a windows app that uses a specific version of a dll- version 5. I have built an installer for this project, removing the dll from the installer package due to legal issues, and I added the following redirection code to account for a newer version of the dll that a user may install.

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <
    dependentAssembly>
    <
    assemblyIdentity name="XXX.YYY" publicKeyToken="X1234YY12345X44Y"/>
    <
    bindingRedirect oldVersion="0.0.0.0-6.1.0.0" newVersion="6.1.3.0"/>
    <publisherPolicy apply="no"/>
    </
    dependentAssembly>
    </assemblyBinding>


    To test that this code works as I expect it to. I ran the installer on a machine that only had version 6.1.3.0 of the dll installed. When I ran the project it did not run at all. Have I done this correctly?  Please advice.

    Thanks!
    my favorite place on the net is msdn!


    Thursday, December 10, 2009 4:47 PM

Answers

  • The redirection is done correctly, simply because the driver is able to load itself (otherwise, you would have a "Could not load assembly ..." exception). Probably, something has changes since the last release and therefore a 127.0.0.1 is failing.

    Did you provide the correct connection string (username, password, host (try localhost))?
    Geert van Horrik - CatenaLogic
    Visit my blog: http://blog.catenalogic.com

    Looking for a way to deploy your updates to all your clients? Try Updater!
    • Marked as answer by eryang Friday, December 18, 2009 2:24 AM
    Friday, December 11, 2009 3:33 PM

All replies

  • Please check the event log, it should provide more information for you.

    Some possible reasons:

    * You did not register the assembly in the GAC


    Geert van Horrik - CatenaLogic
    Visit my blog: http://blog.catenalogic.com

    Looking for a way to deploy your updates to all your clients? Try Updater!
    Friday, December 11, 2009 11:40 AM
  • I've checked the GAC and it is there, the installer of the assembly places it there by default. The dll I'm using is the MySql/.Net connector. I've placed it in a windows app and a web app. Now when I ran the web app I get the follwing exceptions


    [SocketException (0x274d): No connection could be made because the target machine actively refused it 127.0.0.1:3306]
       System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) +1547515
       MySql.Data.Common.StreamCreator.CreateSocketStream(IPAddress ip, Boolean unix) +266
       MySql.Data.Common.StreamCreator.GetStream(UInt32 timeout) +491
       MySql.Data.MySqlClient.NativeDriver.Open() +258




    [MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.]
       MySql.Data.MySqlClient.NativeDriver.Open() +326
       MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings) +48
       MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection() +11
       MySql.Data.MySqlClient.MySqlPool.GetPooledConnection() +190
       MySql.Data.MySqlClient.MySqlPool.TryToGetDriver() +129
       MySql.Data.MySqlClient.MySqlPool.GetConnection() +106
       MySql.Data.MySqlClient.MySqlConnection.Open() +293
       System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +31
       System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +112
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +287
       System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +94
       Project.Page.BindData() in C:\\\\\\Page.ascx.vb:32
       Project.Page.Page_Load(Object sender, EventArgs e) in C:\\\\\\Page.ascx.vb:10
       System.Web.UI.Control.OnLoad(EventArgs e) +99
       System.Web.UI.Control.LoadRecursive() +50
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Control.LoadRecursive() +141
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627

    The first error may lead you to believe that the error is caused by a network glitch but when I installed the version I had a reference too in the code I don't get any errors. That made me think that maybe I was doing the binding redirection incorrectly.

    Thanks
    my favorite place on the net is msdn!
    Friday, December 11, 2009 2:29 PM
  • The redirection is done correctly, simply because the driver is able to load itself (otherwise, you would have a "Could not load assembly ..." exception). Probably, something has changes since the last release and therefore a 127.0.0.1 is failing.

    Did you provide the correct connection string (username, password, host (try localhost))?
    Geert van Horrik - CatenaLogic
    Visit my blog: http://blog.catenalogic.com

    Looking for a way to deploy your updates to all your clients? Try Updater!
    • Marked as answer by eryang Friday, December 18, 2009 2:24 AM
    Friday, December 11, 2009 3:33 PM
  • Sorry for the late reply but I had to thank you! You were right it was my connection string that wasn't being saved to the config file. Assembly redirection was something completly new to me so I wasn't sure if I was doing right or if I had understood its functionality at all. I naively assumed that it I hadn't done it correctly when I got that error. It's always the simple, right under your nose things we over look. Thanks again!
    my favorite place on the net is msdn!
    Monday, December 21, 2009 7:01 PM