Friday 15 April 2011

c# - ASP.NET self host error -



c# - ASP.NET self host error -

i'm trying asp.net web api self host running. maintain getting error.

how resolve this?

assuming assembly reference microsoft.owin, version=2.0.2.0, culture=neutral, publickeytoken=31bf3856ad364e35' matches assemblymicrosoft.owin, version=3.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35'. may need supply runtime policy (cs1701)

here simple start script.

static void main(string[] args) { using (webapp.start<testapi> ("http://*:9090/")) { console.writeline ("server started"); } }

the 2 assemblies differ in release and/or version number. unification occur, must specify directives in application's .config file, , must provide right strong name of assembly, demonstrated in next illustration code:

using system.reflection; [assembly:assemblyversion("1.0")] public class { public void m1() {} }

or:

perhaps need binding redirect in .config

<configuration> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="microsoft.owin" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.0.2.0" newversion="2.0.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="microsoft.owin.security" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-2.0.2.0" newversion="2.0.2.0" /> </dependentassembly> </assemblybinding> </runtime> </configuration>

c# asp.net asp.net-web-api self-hosting

No comments:

Post a Comment