asp.net mvc 4 - Azure In Role Caching Doesn't start on server with "Not running in a hosted service or the Development Fabric." -


i started use azure in-role caching , works great in azure compute emulator on local machine, not on server. i've dealed problems, lack of msshrtmi.dll on server, can't understand why error:

not running in hosted service or development fabric.    description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.    exception details: system.invalidoperationexception: not running in hosted service or development fabric.  source error:     unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below.    stack trace:     [invalidoperationexception: not running in hosted service or development fabric.]    microsoft.windowsazure.diagnostics.diagnosticmonitor.getdefaultstartupinfoforcurrentroleinstance() +535    microsoft.windowsazure.diagnostics.diagnosticmonitortracelistener..ctor() +34  [configurationerrorsexception: not create microsoft.windowsazure.diagnostics.diagnosticmonitortracelistener, microsoft.windowsazure.diagnostics, version=2.3.0.0, culture=neutral, publickeytoken=31bf3856ad364e35.]    system.diagnostics.traceutils.getruntimeobject(string classname, type basetype, string initializedata) +1588    system.diagnostics.typedelement.basegetruntimeobject() +103    system.diagnostics.listenerelement.getruntimeobject() +825    system.diagnostics.listenerelementscollection.getruntimeobject() +261    system.diagnostics.traceinternal.get_listeners() +256    system.diagnostics.trace.get_listeners() +79    microsoft.applicationserver.caching.datacacheserverlogmanager..cctor() +97  [typeinitializationexception: type initializer 'microsoft.applicationserver.caching.datacacheserverlogmanager' threw exception.]    microsoft.applicationserver.caching.datacacheserverlogmanager.changeloglevel(tracelevel tracelevel) +0    microsoft.applicationserver.caching.serviceconfigurationmanager..cctor() +24  [typeinitializationexception: type initializer 'microsoft.applicationserver.caching.serviceconfigurationmanager' threw exception.]    microsoft.applicationserver.caching.serviceconfigurationmanager.gethostdefaults() +0    microsoft.applicationserver.caching.omcachenodeproperties..ctor(ihostconfiguration props, int32 maxnc, boolean perfcounterrequired) +69    microsoft.applicationserver.caching.localcachestore..ctor(evictionparametrs evictionparams) +50    microsoft.applicationserver.caching.datacachefactory..ctor(datacachefactoryconfiguration configuration) +555    microsoft.web.distributedcache.datacachefactorywrapper.createdatacachefactoryfromconfiguration(datacachefactoryconfiguration config) +35    microsoft.web.distributedcache.cachehelpers.runcachecreationhooks(cacheconnectingeventargs fetchingeventargs, idatacachefactory datacachefactory, object sender, eventhandler`1 fetchinghandler, eventhandler`1 fetchedhandler) +70    microsoft.web.distributedcache.distributedcacheoutputcacheprovider.createinternalprovider(ihttpruntime httpruntime, outputcacheinitializationdata initdata, idatacachefactory datacachefactory, eventhandler`1 cachefetching, eventhandler`1 cachefetched) +123    microsoft.web.distributedcache.distributedcacheoutputcacheprovider.getinternalprovider() +224    microsoft.web.distributedcache.distributedcacheoutputcacheprovider.get(string key) +13    system.web.caching.outputcache.get(string key) +80    system.web.caching.outputcachemodule.onenter(object source, eventargs eventargs) +321    system.web.synceventexecutionstep.system.web.httpapplication.iexecutionstep.execute() +182    system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +165 

all found error occurs if start local azure compute emulator in-role caching , without administrative rights. in emulator works fine , problem occurs after publish staging environment. (if switch production, error remains).

i use cache resolving routes /username , /countryname etc. available usernames , country names cached , updated on changes in database. have static class static datacache object created on first request cache. home page doesn't start error occurs before try create cache object.

web.config. remove cache , cache diagnostics related configurations web.config, app starts.

<configuration>   <configsections>          <section name="datacacheclients" type="microsoft.applicationserver.caching.datacacheclientssection, microsoft.applicationserver.caching.core" allowlocation="true" allowdefinition="everywhere" />   <section name="cachediagnostics" type="microsoft.applicationserver.caching.azurecommon.diagnosticsconfigurationsection, microsoft.applicationserver.caching.azurecommon" allowlocation="true" allowdefinition="everywhere" /></configsections>   <system.diagnostics>     <trace>       <listeners>         <add type="microsoft.windowsazure.diagnostics.diagnosticmonitortracelistener, microsoft.windowsazure.diagnostics, version=2.3.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" name="azurediagnostics" />       </listeners>     </trace>   </system.diagnostics>   <system.data>     <dbproviderfactories>       <add name="sql azure reliable provider" invariant="reliabledbprovider.sqlazure" description="reliable db provider sql azure" type="reliabledbprovider.sqlazure.sqlazureprovider, reliabledbprovider" />       <add name="sql azure reliable provider timeout retries" invariant="reliabledbprovider.sqlazurewithtimeoutretries" description="reliable db provider sql azure timeout retries" type="reliabledbprovider.sqlazurewithtimeoutretries.sqlazureprovider, reliabledbprovider" />     </dbproviderfactories>   </system.data>   <connectionstrings>     <add name="appdb" connectionstring="value" />     <add name="storageconnectionstring" connectionstring="value" />   </connectionstrings>   <appsettings>     <add key="webpages:version" value="2.0.0.0" />     <add key="preserveloginurl" value="true" />     <add key="clientvalidationenabled" value="true" />     <add key="unobtrusivejavascriptenabled" value="true" />   </appsettings>   <!--     description of web.config changes see http://go.microsoft.com/fwlink/?linkid=235367.      following attributes can set on <httpruntime> tag.       <system.web>         <httpruntime targetframework="4.5" />       </system.web>   -->   <system.web>     <customerrors mode="off" />     <rolemanager enabled="true" defaultprovider="provider">       <providers>         <clear />         <remove name="aspnetsqlroleprovider" />         <add name="name" type="type" />       </providers>     </rolemanager>     <membership defaultprovider="provider">       <providers>         <clear />         <remove name="aspnetsqlmembershipprovider" />         <add name="name" type="type" enablepasswordretrieval="false" enablepasswordreset="true" requiresquestionandanswer="false" requiresuniqueemail="true" passwordformat="hashed" maxinvalidpasswordattempts="5" minrequiredpasswordlength="8" minrequirednonalphanumericcharacters="0" passwordattemptwindow="10" passwordstrengthregularexpression="" applicationname="name" />       </providers>     </membership>     <machinekey validationkey="key" decryptionkey="key" validation="sha1" decryption="aes" />     <httpcookies httponlycookies="true" requiressl="false" />     <authentication mode="forms">       <forms loginurl="~/account/logon" protection="all" path="/" enablecrossappredirects="true" timeout="2880" />     </authentication>     <compilation debug="true" targetframework="4.5">       <assemblies>         <add assembly="system.web.abstractions, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.helpers, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.routing, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />         <add assembly="system.web.webpages, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />       </assemblies>     </compilation>     <pages controlrenderingcompatibilityversion="4.0">       <namespaces>         <add namespace="system.web.helpers" />         <add namespace="system.web.mvc" />         <add namespace="system.web.mvc.ajax" />         <add namespace="system.web.mvc.html" />         <add namespace="system.web.routing" />         <add namespace="system.web.webpages" />         <add namespace="system.web.optimization" />       </namespaces>     </pages>     <httpruntime maxrequestlength="1048576" />     <globalization enableclientbasedculture="true" uiculture="auto" culture="auto" />   <!-- windows azure cache session state provider --><!--<sessionstate mode="custom" customprovider="afcachesessionstateprovider">       <providers>         <add name="afcachesessionstateprovider" type="microsoft.web.distributedcache.distributedcachesessionstatestoreprovider, microsoft.web.distributedcache" cachename="default" datacacheclientname="default" applicationname="afcachesessionstate"/>       </providers>     </sessionstate>--><!-- windows azure cache output cache provider --><!--uncomment section use windows azure cache output cache-->     <caching>       <outputcache defaultprovider="afcacheoutputcacheprovider">         <providers>           <add name="afcacheoutputcacheprovider" type="microsoft.web.distributedcache.distributedcacheoutputcacheprovider, microsoft.web.distributedcache" cachename="default" datacacheclientname="default" applicationname="afcacheoutputcache" />         </providers>       </outputcache>     </caching>   </system.web>   <system.webserver>     <staticcontent>       <clientcache cachecontrolmode="usemaxage" cachecontrolmaxage="30.00:00:00" />     </staticcontent>     <validation validateintegratedmodeconfiguration="false" />     <modules runallmanagedmodulesforallrequests="false" />     <directorybrowse enabled="false" />     <httpprotocol>       <customheaders>         <!-- enable cross domain ajax calls -->         <remove name="access-control-allow-origin" />         <add name="access-control-allow-origin" value="*" />       </customheaders>     </httpprotocol>     <handlers>       <add name="urlroutinghandler" type="system.web.routing.urlroutinghandler,                   system.web, version=4.0.0.0,                   culture=neutral,                   publickeytoken=b03f5f7f11d50a3a" path="path" verb="get" />       <add name="urlroutinghandleremaillogo" type="system.web.routing.urlroutinghandler,system.web, version=4.0.0.0,culture=neutral,publickeytoken=b03f5f7f11d50a3a" path="path" verb="get" />       <add name="urlroutinghandlersitemap" type="system.web.routing.urlroutinghandler,                   system.web, version=4.0.0.0,                   culture=neutral,                   publickeytoken=b03f5f7f11d50a3a" path="path" verb="get" />     </handlers>   </system.webserver>   <runtime>     <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">       <dependentassembly>         <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" />         <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="4.0.0.0" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="webgrease" publickeytoken="31bf3856ad364e35" culture="neutral" />         <bindingredirect oldversion="0.0.0.0-1.5.2.14234" newversion="1.5.2.14234" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="system.web.abstractions" publickeytoken="31bf3856ad364e35" culture="neutral" />         <bindingredirect oldversion="0.0.0.0-4.0.0.0" newversion="4.0.0.0" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="system.web" publickeytoken="b03f5f7f11d50a3a" culture="neutral" />         <bindingredirect oldversion="0.0.0.0-4.0.0.0" newversion="4.0.0.0" />       </dependentassembly>       <dependentassembly>         <assemblyidentity name="microsoft.windowsazure.diagnostics" publickeytoken="31bf3856ad364e35" culture="neutral" />         <bindingredirect oldversion="0.0.0.0-2.2.0.0" newversion="2.2.0.0" />       </dependentassembly>     </assemblybinding>   </runtime>   <system.net>     <mailsettings>       <smtp deliverymethod="network">         <network host="host" username="username" password="password" />       </smtp>     </mailsettings>   </system.net>   <system.web.extensions>     <scripting>       <webservices>         <jsonserialization maxjsonlength="2147483644" />       </webservices>     </scripting>   </system.web.extensions>   <datacacheclients>     <datacacheclient name="default">                       <autodiscover isenabled="true" identifier="sub2o" />       <localcache isenabled="true" sync="timeoutbased" objectcount="100000" ttlvalue="300" />             </datacacheclient>       </datacacheclients>   <cachediagnostics>     <crashdump dumplevel="off" dumpstoragequotainmb="100" />   </cachediagnostics> </configuration> 

serviceconfiguration.cloud.cscfg

<serviceconfiguration servicename="windowsazure" xmlns="http://schemas.microsoft.com/servicehosting/2008/10/serviceconfiguration" osfamily="3" osversion="*" schemaversion="2013-10.2.2">   <role name="sub2o">     <instances count="1" />     <configurationsettings>       <setting name="microsoft.windowsazure.plugins.diagnostics.connectionstring" value="defaultendpointsprotocol=https;accountname=name;accountkey=key" />       <setting name="microsoft.windowsazure.plugins.remoteaccess.enabled" value="true" />       <setting name="microsoft.windowsazure.plugins.remoteaccess.accountusername" value="username" />       <setting name="microsoft.windowsazure.plugins.remoteaccess.accountencryptedpassword" value="password" />       <setting name="microsoft.windowsazure.plugins.remoteaccess.accountexpiration" value="2014-09-07t23:59:59.0000000+04:00" />       <setting name="microsoft.windowsazure.plugins.remoteforwarder.enabled" value="true" />       <setting name="microsoft.appinsights.accountid" value="id" />       <setting name="microsoft.appinsights.instrumentationkey" value="key" />       <setting name="microsoft.appinsights.enablemonitoring" value="true" />       <!-- uncomment following section if want change display name of application on application insights portal. (default webrole name)-->       <!--<setting name="microsoft.appinsights.displayname" value="name" />-->       <setting name="microsoft.windowsazure.plugins.caching.clientdiagnosticlevel" value="1" />       <setting name="microsoft.windowsazure.plugins.caching.namedcaches" value="{&quot;caches&quot;:[{&quot;name&quot;:&quot;default&quot;,&quot;policy&quot;:{&quot;eviction&quot;:{&quot;type&quot;:0},&quot;expiration&quot;:{&quot;defaultttl&quot;:10,&quot;isexpirable&quot;:true,&quot;type&quot;:1},&quot;servernotification&quot;:{&quot;isenabled&quot;:false}},&quot;secondaries&quot;:0}]}" />       <setting name="microsoft.windowsazure.plugins.caching.diagnosticlevel" value="1" />       <setting name="microsoft.windowsazure.plugins.caching.cachesizepercentage" value="30" />       <setting name="microsoft.windowsazure.plugins.caching.configstoreconnectionstring" value="defaultendpointsprotocol=https;accountname=name;accountkey=key" />     </configurationsettings>     <certificates>       <certificate name="microsoft.windowsazure.plugins.remoteaccess.passwordencryption" thumbprint="value" thumbprintalgorithm="sha1" />     </certificates>   </role> </serviceconfiguration> 

servicedefinition.csdef

<?xml version="1.0"?> <servicedefinition name="windowsazure" xmlns="http://schemas.microsoft.com/servicehosting/2008/10/servicedefinition" schemaversion="2013-10.2.2">   <webrole name="sub2o" vmsize="small">     <sites>       <site name="web">         <bindings>           <binding name="endpoint1" endpointname="endpoint1" />         </bindings>       </site>     </sites>     <endpoints>       <inputendpoint name="endpoint1" protocol="http" port="80" />     </endpoints>     <imports>       <import modulename="diagnostics" />       <import modulename="remoteaccess" />       <import modulename="remoteforwarder" />       <import modulename="caching" />     </imports>     <startup priority="-2">       <task commandline="appinsightsagent\unifiedbootstrap.bat" executioncontext="elevated" tasktype="background">       </task>       <task commandline="microsoft.windowsazure.caching\clientperfcountersinstaller.exe install" executioncontext="elevated" tasktype="simple" />     </startup>     <configurationsettings>       <setting name="microsoft.appinsights.accountid" />       <setting name="microsoft.appinsights.instrumentationkey" />       <setting name="microsoft.appinsights.enablemonitoring" />       <!-- uncomment following section if want change display name of application on application insights portal. (default webrole name)-->       <!--<setting name="microsoft.appinsights.displayname" />-->       <setting name="microsoft.windowsazure.plugins.caching.clientdiagnosticlevel" />     </configurationsettings>     <localresources>       <localstorage name="diagnosticstore" sizeinmb="20000" cleanonrolerecycle="false" />     </localresources>   </webrole> </servicedefinition> 

problem caused conflict between sdk 2.2 , 2.3. need update sdk windows azure cloud service project properties->application. simple.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -