Issues with TokenClient in IdentityModel











up vote
1
down vote

favorite












I have a new MVC project using TokenClient from IdentityModel



var tokenClient = new TokenClient(tokenUrl, clientId, CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


I have the nuget package in for IdentityModel and everything compiles fine. However, at runtime I get the following error.




Method not found: 'Void
IdentityModel.Client.TokenClient..ctor(System.String, System.String,
System.String, System.Net.Http.HttpMessageHandler,
IdentityModel.Client.AuthenticationStyle)'.




The .NET version of the MVC project is 4.6.1



What can be causing this issue? I have been searching google and cannot find anything that helps. It must be something simple that i am missing.



EDIT:



initializing it by declaring the parameters explicitly does not work either.



var tokenClient = new TokenClient(tokenUrl, clientId: clientId, clientSecret: CLIENT_SECRET);// CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


However initializing it with the one parameter works fine.



var tokenClient = new TokenClient(tokenUrl);









share|improve this question
























  • Check out this other SO Q/A....can you confirm/deny any of these possible solutions? stackoverflow.com/questions/7578583/method-not-found-on-runtime
    – user1011627
    Nov 20 at 15:45










  • it is a brand new project that has a nuget reference to IdentityModel version 3.10.1. The project is just the standard mvc template project that you get when you create the project
    – markblue777
    Nov 20 at 15:55















up vote
1
down vote

favorite












I have a new MVC project using TokenClient from IdentityModel



var tokenClient = new TokenClient(tokenUrl, clientId, CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


I have the nuget package in for IdentityModel and everything compiles fine. However, at runtime I get the following error.




Method not found: 'Void
IdentityModel.Client.TokenClient..ctor(System.String, System.String,
System.String, System.Net.Http.HttpMessageHandler,
IdentityModel.Client.AuthenticationStyle)'.




The .NET version of the MVC project is 4.6.1



What can be causing this issue? I have been searching google and cannot find anything that helps. It must be something simple that i am missing.



EDIT:



initializing it by declaring the parameters explicitly does not work either.



var tokenClient = new TokenClient(tokenUrl, clientId: clientId, clientSecret: CLIENT_SECRET);// CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


However initializing it with the one parameter works fine.



var tokenClient = new TokenClient(tokenUrl);









share|improve this question
























  • Check out this other SO Q/A....can you confirm/deny any of these possible solutions? stackoverflow.com/questions/7578583/method-not-found-on-runtime
    – user1011627
    Nov 20 at 15:45










  • it is a brand new project that has a nuget reference to IdentityModel version 3.10.1. The project is just the standard mvc template project that you get when you create the project
    – markblue777
    Nov 20 at 15:55













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a new MVC project using TokenClient from IdentityModel



var tokenClient = new TokenClient(tokenUrl, clientId, CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


I have the nuget package in for IdentityModel and everything compiles fine. However, at runtime I get the following error.




Method not found: 'Void
IdentityModel.Client.TokenClient..ctor(System.String, System.String,
System.String, System.Net.Http.HttpMessageHandler,
IdentityModel.Client.AuthenticationStyle)'.




The .NET version of the MVC project is 4.6.1



What can be causing this issue? I have been searching google and cannot find anything that helps. It must be something simple that i am missing.



EDIT:



initializing it by declaring the parameters explicitly does not work either.



var tokenClient = new TokenClient(tokenUrl, clientId: clientId, clientSecret: CLIENT_SECRET);// CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


However initializing it with the one parameter works fine.



var tokenClient = new TokenClient(tokenUrl);









share|improve this question















I have a new MVC project using TokenClient from IdentityModel



var tokenClient = new TokenClient(tokenUrl, clientId, CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


I have the nuget package in for IdentityModel and everything compiles fine. However, at runtime I get the following error.




Method not found: 'Void
IdentityModel.Client.TokenClient..ctor(System.String, System.String,
System.String, System.Net.Http.HttpMessageHandler,
IdentityModel.Client.AuthenticationStyle)'.




The .NET version of the MVC project is 4.6.1



What can be causing this issue? I have been searching google and cannot find anything that helps. It must be something simple that i am missing.



EDIT:



initializing it by declaring the parameters explicitly does not work either.



var tokenClient = new TokenClient(tokenUrl, clientId: clientId, clientSecret: CLIENT_SECRET);// CLIENT_SECRET, null, AuthenticationStyle.BasicAuthentication);


However initializing it with the one parameter works fine.



var tokenClient = new TokenClient(tokenUrl);






c# asp.net-identity






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 at 15:58

























asked Nov 20 at 15:27









markblue777

3691318




3691318












  • Check out this other SO Q/A....can you confirm/deny any of these possible solutions? stackoverflow.com/questions/7578583/method-not-found-on-runtime
    – user1011627
    Nov 20 at 15:45










  • it is a brand new project that has a nuget reference to IdentityModel version 3.10.1. The project is just the standard mvc template project that you get when you create the project
    – markblue777
    Nov 20 at 15:55


















  • Check out this other SO Q/A....can you confirm/deny any of these possible solutions? stackoverflow.com/questions/7578583/method-not-found-on-runtime
    – user1011627
    Nov 20 at 15:45










  • it is a brand new project that has a nuget reference to IdentityModel version 3.10.1. The project is just the standard mvc template project that you get when you create the project
    – markblue777
    Nov 20 at 15:55
















Check out this other SO Q/A....can you confirm/deny any of these possible solutions? stackoverflow.com/questions/7578583/method-not-found-on-runtime
– user1011627
Nov 20 at 15:45




Check out this other SO Q/A....can you confirm/deny any of these possible solutions? stackoverflow.com/questions/7578583/method-not-found-on-runtime
– user1011627
Nov 20 at 15:45












it is a brand new project that has a nuget reference to IdentityModel version 3.10.1. The project is just the standard mvc template project that you get when you create the project
– markblue777
Nov 20 at 15:55




it is a brand new project that has a nuget reference to IdentityModel version 3.10.1. The project is just the standard mvc template project that you get when you create the project
– markblue777
Nov 20 at 15:55












2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










IdentityModel is a 3rd party library built by the creators of Identity Server. v3.10.1 definitely does have that method overload in it. I have recreated your error and the reason you are getting the error is because IdentityModel v3.10.1 is not compatible with .NET Framework 4.6.1. The creators changed the signature of that overload and made the HttpMessageHandler an optional parameter so your code will compile, but will throw this Method Not Found error at runtime. The IdentityModel project you are referencing has been archived by the guys at Identity Server so I would recommend migrating if you can.



You have a couple of options as I see it:



1) Migrate to .NET Core and leverage IdentityModel v2.



2) Downgrade your project to .NET Framework 4.5.2 (the last compatible version for IdentityModel V1)



3) Do not use this overload (as you've already found the single tokenUrl param works). I would stay away from this approach as you are likely to run into additional compatibility issues.



Basically, if you don't want to migrate to .NET Core, keep this project on 4.5.2. If you can migrate, do that instead. Identity Server is moving toward .NET Core as a whole anyway and you will get more mileage by making that leap now.






share|improve this answer





















  • Thanks for the reply, I thought it was going to be something simple to fix this issue. This work is for a POC so no room to learn anything new. However, looks like I am going to have to move towards .net core.
    – markblue777
    Nov 21 at 7:55










  • Welcome...if just POC I would just create the app as 4.5.2 unless you need something from .NET Framework above that version. I tested that method on that version and it does in fact work. Best of luck in whichever direction you go.
    – user1011627
    Nov 21 at 15:02


















up vote
0
down vote













I encountered the same problem while working through the MVC Getting Started example for IdentityServer3. If you check the dependencies for IdentityModel v3.10.1 you'll notice that it depends on System.Net.Http (>= 4.3.3). My project had v 4.2, updating to the current version solved the problem.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396295%2fissues-with-tokenclient-in-identitymodel%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    IdentityModel is a 3rd party library built by the creators of Identity Server. v3.10.1 definitely does have that method overload in it. I have recreated your error and the reason you are getting the error is because IdentityModel v3.10.1 is not compatible with .NET Framework 4.6.1. The creators changed the signature of that overload and made the HttpMessageHandler an optional parameter so your code will compile, but will throw this Method Not Found error at runtime. The IdentityModel project you are referencing has been archived by the guys at Identity Server so I would recommend migrating if you can.



    You have a couple of options as I see it:



    1) Migrate to .NET Core and leverage IdentityModel v2.



    2) Downgrade your project to .NET Framework 4.5.2 (the last compatible version for IdentityModel V1)



    3) Do not use this overload (as you've already found the single tokenUrl param works). I would stay away from this approach as you are likely to run into additional compatibility issues.



    Basically, if you don't want to migrate to .NET Core, keep this project on 4.5.2. If you can migrate, do that instead. Identity Server is moving toward .NET Core as a whole anyway and you will get more mileage by making that leap now.






    share|improve this answer





















    • Thanks for the reply, I thought it was going to be something simple to fix this issue. This work is for a POC so no room to learn anything new. However, looks like I am going to have to move towards .net core.
      – markblue777
      Nov 21 at 7:55










    • Welcome...if just POC I would just create the app as 4.5.2 unless you need something from .NET Framework above that version. I tested that method on that version and it does in fact work. Best of luck in whichever direction you go.
      – user1011627
      Nov 21 at 15:02















    up vote
    1
    down vote



    accepted










    IdentityModel is a 3rd party library built by the creators of Identity Server. v3.10.1 definitely does have that method overload in it. I have recreated your error and the reason you are getting the error is because IdentityModel v3.10.1 is not compatible with .NET Framework 4.6.1. The creators changed the signature of that overload and made the HttpMessageHandler an optional parameter so your code will compile, but will throw this Method Not Found error at runtime. The IdentityModel project you are referencing has been archived by the guys at Identity Server so I would recommend migrating if you can.



    You have a couple of options as I see it:



    1) Migrate to .NET Core and leverage IdentityModel v2.



    2) Downgrade your project to .NET Framework 4.5.2 (the last compatible version for IdentityModel V1)



    3) Do not use this overload (as you've already found the single tokenUrl param works). I would stay away from this approach as you are likely to run into additional compatibility issues.



    Basically, if you don't want to migrate to .NET Core, keep this project on 4.5.2. If you can migrate, do that instead. Identity Server is moving toward .NET Core as a whole anyway and you will get more mileage by making that leap now.






    share|improve this answer





















    • Thanks for the reply, I thought it was going to be something simple to fix this issue. This work is for a POC so no room to learn anything new. However, looks like I am going to have to move towards .net core.
      – markblue777
      Nov 21 at 7:55










    • Welcome...if just POC I would just create the app as 4.5.2 unless you need something from .NET Framework above that version. I tested that method on that version and it does in fact work. Best of luck in whichever direction you go.
      – user1011627
      Nov 21 at 15:02













    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    IdentityModel is a 3rd party library built by the creators of Identity Server. v3.10.1 definitely does have that method overload in it. I have recreated your error and the reason you are getting the error is because IdentityModel v3.10.1 is not compatible with .NET Framework 4.6.1. The creators changed the signature of that overload and made the HttpMessageHandler an optional parameter so your code will compile, but will throw this Method Not Found error at runtime. The IdentityModel project you are referencing has been archived by the guys at Identity Server so I would recommend migrating if you can.



    You have a couple of options as I see it:



    1) Migrate to .NET Core and leverage IdentityModel v2.



    2) Downgrade your project to .NET Framework 4.5.2 (the last compatible version for IdentityModel V1)



    3) Do not use this overload (as you've already found the single tokenUrl param works). I would stay away from this approach as you are likely to run into additional compatibility issues.



    Basically, if you don't want to migrate to .NET Core, keep this project on 4.5.2. If you can migrate, do that instead. Identity Server is moving toward .NET Core as a whole anyway and you will get more mileage by making that leap now.






    share|improve this answer












    IdentityModel is a 3rd party library built by the creators of Identity Server. v3.10.1 definitely does have that method overload in it. I have recreated your error and the reason you are getting the error is because IdentityModel v3.10.1 is not compatible with .NET Framework 4.6.1. The creators changed the signature of that overload and made the HttpMessageHandler an optional parameter so your code will compile, but will throw this Method Not Found error at runtime. The IdentityModel project you are referencing has been archived by the guys at Identity Server so I would recommend migrating if you can.



    You have a couple of options as I see it:



    1) Migrate to .NET Core and leverage IdentityModel v2.



    2) Downgrade your project to .NET Framework 4.5.2 (the last compatible version for IdentityModel V1)



    3) Do not use this overload (as you've already found the single tokenUrl param works). I would stay away from this approach as you are likely to run into additional compatibility issues.



    Basically, if you don't want to migrate to .NET Core, keep this project on 4.5.2. If you can migrate, do that instead. Identity Server is moving toward .NET Core as a whole anyway and you will get more mileage by making that leap now.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 20 at 17:10









    user1011627

    1,1631017




    1,1631017












    • Thanks for the reply, I thought it was going to be something simple to fix this issue. This work is for a POC so no room to learn anything new. However, looks like I am going to have to move towards .net core.
      – markblue777
      Nov 21 at 7:55










    • Welcome...if just POC I would just create the app as 4.5.2 unless you need something from .NET Framework above that version. I tested that method on that version and it does in fact work. Best of luck in whichever direction you go.
      – user1011627
      Nov 21 at 15:02


















    • Thanks for the reply, I thought it was going to be something simple to fix this issue. This work is for a POC so no room to learn anything new. However, looks like I am going to have to move towards .net core.
      – markblue777
      Nov 21 at 7:55










    • Welcome...if just POC I would just create the app as 4.5.2 unless you need something from .NET Framework above that version. I tested that method on that version and it does in fact work. Best of luck in whichever direction you go.
      – user1011627
      Nov 21 at 15:02
















    Thanks for the reply, I thought it was going to be something simple to fix this issue. This work is for a POC so no room to learn anything new. However, looks like I am going to have to move towards .net core.
    – markblue777
    Nov 21 at 7:55




    Thanks for the reply, I thought it was going to be something simple to fix this issue. This work is for a POC so no room to learn anything new. However, looks like I am going to have to move towards .net core.
    – markblue777
    Nov 21 at 7:55












    Welcome...if just POC I would just create the app as 4.5.2 unless you need something from .NET Framework above that version. I tested that method on that version and it does in fact work. Best of luck in whichever direction you go.
    – user1011627
    Nov 21 at 15:02




    Welcome...if just POC I would just create the app as 4.5.2 unless you need something from .NET Framework above that version. I tested that method on that version and it does in fact work. Best of luck in whichever direction you go.
    – user1011627
    Nov 21 at 15:02












    up vote
    0
    down vote













    I encountered the same problem while working through the MVC Getting Started example for IdentityServer3. If you check the dependencies for IdentityModel v3.10.1 you'll notice that it depends on System.Net.Http (>= 4.3.3). My project had v 4.2, updating to the current version solved the problem.






    share|improve this answer

























      up vote
      0
      down vote













      I encountered the same problem while working through the MVC Getting Started example for IdentityServer3. If you check the dependencies for IdentityModel v3.10.1 you'll notice that it depends on System.Net.Http (>= 4.3.3). My project had v 4.2, updating to the current version solved the problem.






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        I encountered the same problem while working through the MVC Getting Started example for IdentityServer3. If you check the dependencies for IdentityModel v3.10.1 you'll notice that it depends on System.Net.Http (>= 4.3.3). My project had v 4.2, updating to the current version solved the problem.






        share|improve this answer












        I encountered the same problem while working through the MVC Getting Started example for IdentityServer3. If you check the dependencies for IdentityModel v3.10.1 you'll notice that it depends on System.Net.Http (>= 4.3.3). My project had v 4.2, updating to the current version solved the problem.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 at 13:33









        rjax

        114




        114






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53396295%2fissues-with-tokenclient-in-identitymodel%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python