c# - asp.net mvc core The call is ambiguous between the following methods or properties: -


i working on application, , got error in startup.cs partial classes, , cant find why error shows up:

the call ambiguous between following methods or properties: microsoft.extensions.dependencyinjection.optionsservicecollectionextensions.configure(microsoft.extensions.dependencyinjection.iservicecollection, system.action) microsoft.extensions.dependencyinjection.optionsservicecollectionextensions.configure(microsoft.extensions.dependencyinjection.iservicecollection, system.action)

my 2 partial startup.cs classes are

using microsoft.extensions.dependencyinjection; using system.security.claims; using microsoft.aspnetcore.http; using microsoft.extensions.configuration;   namespace giftuwish.webapi {     public partial class startup     {         private void setservices(iservicecollection services)         {             //profile service , repository             services.addscoped<iprofileservice, profileservice>();             services.addscoped<iprofilerepository, profilerepository>();              ////gift service , repository             services.addscoped<ibankaccountservice, bankaccountservice>();             services.addscoped<ibankaccountrepository, bankaccountrepository>();              //event service , repository             services.addscoped<icreditcardservice, creditcardservice>();             services.addscoped<icreditcardrepository, creditcardrepository>();               //credit card information serice , repository             services.addscoped<ipaypalservice, paypalservice>();             services.addscoped<ipaypalrepository, paypalrepository>();              //chipped in serive , repository             services.addscoped<ishippingadressservice, shippingadressservice>();             services.addscoped<ishippingadressrepository, shippingadressrepository>();              //unit of work             services.addscoped<iunitofwork, unitofwork>();              //authentication-token , header contains information user identity server             services.addtransient<claimsprincipal>(s => s.getservice<ihttpcontextaccessor>().httpcontext.user);              //facebook graph api             services.addscoped<iapi, service.facebbokgraph.api>();              //setup configuration settings form appsettings.json              services.configure<facebookapisettings>(configuration.getsection("facebook"));             services.configure<braintreesettings>(configuration.getsection("paiment:braintree"));             services.configure<paypaladaptivepaymentsapi>(configuration.getsection("paiment:paypal:paypaladaptivepaymentsapi"));             services.configure<paypalnonadaptivepaymentsapi>(configuration.getsection("paiment:paypal:paypalnonadaptivepaymentsapi"));             services.configure<paypalpayflow>(configuration.getsection("paiment:paypal:paypalpayflow"));              services.addsingleton<iconfiguration>(configuration);         }     } }   using microsoft.aspnetcore.authentication.cookies; using microsoft.aspnetcore.builder; using microsoft.aspnetcore.hosting; using microsoft.aspnetcore.http; using microsoft.aspnetcore.mvc; using microsoft.extensions.configuration; using microsoft.extensions.dependencyinjection; using microsoft.extensions.logging; using newtonsoft.json.serialization; using system.threading.tasks;  namespace giftuwish.webapi {     public partial class startup     {         public static iconfiguration configuration { get; set; }          private readonly string audience = "https://localhost:44362/";          public startup(ihostingenvironment env)         {             var builder = new configurationbuilder()                 .setbasepath(env.contentrootpath)                 .addjsonfile("appsettings.json", optional: true, reloadonchange: true)                 .addjsonfile($"appsettings.{env.environmentname}.json", optional: true)                 .addenvironmentvariables();             configuration = builder.build();         }          // method gets called runtime. use method add services container.         public void configureservices(iservicecollection services)         {             // add framework services.             services                 .addmvc(options =>                 {                     options.filters.add(new requirehttpsattribute());                 })                 .addjsonoptions(options =>                 {                     options.serializersettings.contractresolver = new camelcasepropertynamescontractresolver();                 });              services.configure<cookieauthenticationoptions>(options =>             {                 options.events = new cookieauthenticationevents()                 {                     onredirecttologin = ctx =>                     {                         if (ctx.request.path.startswithsegments("/api") && ctx.response.statuscode == 200)                         {                             ctx.response.statuscode = (int)system.net.httpstatuscode.unauthorized;                             return task.fromresult<object>(null);                         }                         else                         {                             ctx.response.redirect(ctx.redirecturi);                             return task.fromresult<object>(null);                         }                     }                 };             });               //add di , other services             setservices(services);         }          // method gets called runtime. use method configure http request pipeline.         public void configure(iapplicationbuilder app, ihostingenvironment env, iloggerfactory loggerfactory)         {             loggerfactory.addconsole(configuration.getsection("logging"));             loggerfactory.adddebug();              app.usedeveloperexceptionpage();              cookieauthenticationoptions options = new cookieauthenticationoptions();             options.authenticationscheme = "cookies";             options.cookiename = "guw cookie";             options.automaticauthenticate = true;             options.automaticchallenge = true;             options.loginpath = new pathstring("/account/login");             options.events = new customcookieauthenticationevents();              app.usecookieauthentication(options);              app.usemvc();         }     } } 

project.json dependencies

"dependencies": { "braintree": "2.61.0", "microsoft.aspnet.mvc.core": "6.0.0-rc1-final", "microsoft.aspnetcore.diagnostics": "1.0.0", "microsoft.aspnetcore.identity": "1.0.0", "microsoft.aspnetcore.mvc": "1.0.0", "microsoft.aspnetcore.server.iisintegration": "1.0.0", "microsoft.aspnetcore.server.kestrel": "1.0.0", "microsoft.extensions.configuration.environmentvariables": "1.0.0", "microsoft.extensions.configuration.fileextensions": "1.0.0", "microsoft.extensions.configuration.json": "1.0.0", "microsoft.extensions.logging": "1.0.0", "microsoft.extensions.logging.console": "1.0.0", "microsoft.extensions.logging.debug": "1.0.0", "microsoft.extensions.options": "1.0.0", "microsoft.extensions.options.configurationextensions": "1.0.0", "microsoft.identitymodel.tokens": "5.0.0", "microsoft.owin.security.cookies": "3.0.1", "microsoft.owin.security.oauth": "3.0.1", "newtonsoft.json": "9.0.1", "paypal": "1.7.3", "paypaladaptiveaccountssdk": "2.9.110", "paypaladaptivepaymentssdk": "2.15.117", "paypalcoresdk": "1.7.1", "paypalmerchantsdk": "2.16.117", "system.identitymodel.tokens.jwt": "5.0.0" },

the error here:

services.configure<facebookapisettings>(configuration.getsection("facebook"));             services.configure<braintreesettings>(configuration.getsection("paiment:braintree"));             services.configure<paypaladaptivepaymentsapi>(configuration.getsection("paiment:paypal:paypaladaptivepaymentsapi"));             services.configure<paypalnonadaptivepaymentsapi>(configuration.getsection("paiment:paypal:paypalnonadaptivepaymentsapi"));             services.configure<paypalpayflow>(configuration.getsection("paiment:paypal:paypalpayflow")); 

thnx

this because mixing package versions - mixed rc1 (microsoft.aspnet.mvc.core": "6.0.0-rc1-final") 1.0.0. move 1.0.0.


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -