c# - SignalR - Decryption key specified has invalid hex characters -


i using signalr 2.2.0 , mvc 4. when load page in chrome, receive error in console:

http://localhost:8180/signalr/negotiate?clientprotocol=1.5&connectiondata=%5b%7b%22name%22%3a%22chathub%22%7d%5d&_=1467627883530 500 (internal server error) 

upon further inspection using fiddler can view stacktrace:

[configurationerrorsexception]: decryption key specified has invalid hex characters. (c:\users\foo\web.config line 66)     @ system.web.security.cryptography.machinekeymasterkeyprovider.generatecryptographickey(string configattributename, string configattributevalue, int32 autogenkeyoffset, int32 autogenkeycount, string errorresourcestring)    @ system.web.security.cryptography.machinekeymasterkeyprovider.getencryptionkey()    @ system.web.security.cryptography.purpose.getderivedencryptionkey(imasterkeyprovider masterkeyprovider, keyderivationfunction keyderivationfunction)    @ system.web.security.cryptography.aspnetcryptoserviceprovider.getnetfxcryptoservice(purpose purpose, cryptoserviceoptions options)    @ system.web.security.cryptography.aspnetcryptoserviceprovider.getcryptoservice(purpose purpose, cryptoserviceoptions options)    @ system.web.security.machinekey.protect(icryptoserviceprovider cryptoserviceprovider, byte[] userdata, string[] purposes)    @ system.web.security.machinekey.protect(byte[] userdata, string[] purposes)    @ microsoft.owin.host.systemweb.dataprotection.machinekeydataprotector.protect(byte[] userdata)    @ microsoft.owin.security.dataprotection.appbuilderextensions.calldataprotectionprovider.calldataprotection.protect(byte[] userdata)    @ microsoft.aspnet.signalr.infrastructure.dataprotectionproviderprotecteddata.protect(string data, string purpose)    @ microsoft.aspnet.signalr.persistentconnection.processnegotiationrequest(hostcontext context)    @ microsoft.aspnet.signalr.persistentconnection.processrequest(hostcontext context)    @ microsoft.aspnet.signalr.hubs.hubdispatcher.processrequest(hostcontext context)    @ microsoft.aspnet.signalr.persistentconnection.processrequest(idictionary`2 environment)    @ microsoft.aspnet.signalr.owin.middleware.hubdispatchermiddleware.invoke(iowincontext context)    @ microsoft.owin.infrastructure.owinmiddlewaretransition.invoke(idictionary`2 environment)    @ microsoft.owin.mapping.mapmiddleware.<invoke>d__0.movenext() 

from i've gathered, signalr using machine key perform encryption/decryption.

this machine key looks like:

<machinekey decryptionkey="5e329ed7de2786fcd906e717c97a09be26b3564bbe0a2b28,isolateapps" validationkey="a64f709fb47b282cb8331205bc423d63450b4ffc92fe06ec1e00b3ae8b5b1f529a5cd1064f66c08545fc13b013f84153598b29213d5494dd5ec348b537a51dae,isolateapps"/> 

i'm guessing it's seeing "isolateapps" in decryptionkey/validationkey , throwing exception ("...invalid hex characters").

if remove "isolateapps" keys, can't log in anymore since i'm using formsauthentication in turn makes use of keys encrypt/decrypt. removing "isolateapps" not seem solution.

ps. code i'm using this tutorial. have looked @ this answer not solve problem. have tried add compatibilitymode="framework20sp1" machine key not work either.

is there way fix issue without removing "isolateapps" value keys in web config?

i have fixed issue. decided remove ",isolateapps" attribute machine key stopped giving exception:

decryption key specified has invalid hex characters

removing attribute meant not log in anymore (since machine key has technically changed) forced me reset account password. once reset password continue logging in.

once able log in receiving error:

ws://xxxxx/signalr/connect?transport=websockets&clientprotocol=1.5&connectiontoken=xxxxx' failed: connection closed before receiving handshake response.

this exception being thrown in chrome.

signalr fell onto server sent events because web socket handshakes weren't successful. after many hours of debugging solved issue adding web config:

<system.web>     <compilation debug="true" targetframework="4.5" />     <httpruntime targetframework="4.5" />     <pages controlrenderingcompatibilityversion="4.0" /> </system.web> 

once added, signalr functioning excepted.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -