c# - Microsoft.Web.Administration FlushUrl method returns 0x080070032 -
i've been wrapping head around last few days, fail come solution.
i want purge arr cache server. however, when execute fails comexception: request not supported. exception hresult: 0x80070032. when don't run in admin mode, -as expected- error: acces_denied.
i have following code:
private const string diskcachesection = "system.webserver/diskcache"; private const string flushurlmethod = "flushurl"; private const string urlmethodattribute = "url"; private const string errorcodestring = "errorcode"; public flushurlresponse flushurl(uri url) { if (url == null) { _logger.error("argumentnullexception on url"); throw new argumentnullexception(nameof(url)); } try { _logger.info($"flush url: {url.absoluteuri}"); //every sections has it's own methods. //but methods not publicly available/described. method found it's methodname, , create instance. var section = _servermanager.getapplicationhostconfiguration().getsection(diskcachesection); _logger.debug("section provided"); var method = section.methods[flushurlmethod].createinstance(); _logger.debug("method created"); _logger.debug($"set attribute: {urlmethodattribute}:{url}"); //then set input variabele. method.input.setattributevalue(urlmethodattribute, url.tostring()); _logger.debug(new detailedlog("attribute setted: ", url.tostring())); //and execute method. method.execute(); _logger.info("method executed"); var result = (long)method.output[errorcodestring]; _logger.info($"response: {result}"); return (flushurlresponse)result; } catch (exception ex) { _logger.error(ex); return flushurlresponse.error; } }
the server running arr: 3.0.1952
externaldiskcache: 1.1.1949
iis: 8.5
does have idea's?
Comments
Post a Comment