Could not load type 'ProtocolSupportModule' - asp.net-mvc

I've found a boss-level error that forced me to become an active member of stackoverflow.
I am hosting an MVC app and on root level it works, however css and images are failing. Even when going to the image directly via URL I get the following error:
Could not load type 'ProtocolSupportModule'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Could not load type 'ProtocolSupportModule'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Could not load type 'ProtocolSupportModule'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +12510809
System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String type) +47
System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +18
System.Web.Configuration.HandlerFactoryCache..ctor(String type) +27
System.Web.HttpApplication.GetFactory(String type) +94
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +375
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

Okay so I figured this out.
Under handler mappings, the OptionsVerbHandler was set to allow all verbs under the request restrictions section. I set it to only allow the OPTIONS verb and created extra handlers for POST and GET.
UPDATE:
WHEN a GETHandler is specified on a folder with stylesheets or images the ProtocolSupportModule error occurs when the image/stylesheet is called. When no Gethandler is present on dll's views, the MVC app displays a verb rights error.
I got around this by setting the handlers on folder level. This is a bad way of doing it. Are there any better ideas? I am sure the MVC framework should handle this automatically?

Related

Visual Studio 2017 Error initializing VroomJs.JsEngine

My project uses Reactjs, and I use Visual Studio 2017. Recently I did an software update on VS 2017, but no code/config changes.
However, when I start my project locally in debug mode, I encountered below error:
No JavaScript engines were registered, falling back to a default config! It is recommended that you configure JavaScriptEngineSwitcher in your app. See https://github.com/Taritsyn/JavaScriptEngineSwitcher/wiki/Registration-of-JS-engines for more information.
Error initialising JavaScriptEngineSwitcher.V8.V8JsEngineFactory: JavaScriptEngineSwitcher.Core.JsEngineLoadException: During loading of V8JsEngine error has occurred.
See more details:
Cannot load V8 interface assembly. Load failure information for v8-ia32.dll:
C:\Users\user1\AppData\Local\Temp\Temporary ASP.NET Files\vs\77655ce5\ca0bb6d0\assembly\dl3\300b733a\003cadac_c3f4d201\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\bin\v8-ia32.dll: The specified module could not be found ---> System.TypeLoadException: Cannot load V8 interface assembly. Load failure information for v8-ia32.dll:
C:\Users\user1\AppData\Local\Temp\Temporary ASP.NET Files\vs\77655ce5\ca0bb6d0\assembly\dl3\300b733a\003cadac_c3f4d201\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\v8-ia32.dll: The specified module could not be found
C:\Code\project1\branches\apps\src\DotNet\COMP.project1.Web\bin\v8-ia32.dll: The specified module could not be found
at Microsoft.ClearScript.V8.V8Proxy.LoadNativeLibrary()
at Microsoft.ClearScript.V8.V8Proxy.LoadAssembly()
at Microsoft.ClearScript.V8.V8Proxy.GetAssembly()
at Microsoft.ClearScript.V8.V8Proxy.GetImplType(Type type)
at Microsoft.ClearScript.V8.V8Proxy.CreateImpl[T](Object[] args)
at Microsoft.ClearScript.V8.V8IsolateProxy.Create(String name, V8RuntimeConstraints constraints, Boolean enableDebugging, Int32 debugPort)
at Microsoft.ClearScript.V8.V8Runtime..ctor(String name, V8RuntimeConstraints constraints, V8RuntimeFlags flags, Int32 debugPort)
at Microsoft.ClearScript.V8.V8ScriptEngine..ctor(V8Runtime runtime, String name, V8RuntimeConstraints constraints, V8ScriptEngineFlags flags, Int32 debugPort)
at JavaScriptEngineSwitcher.V8.V8JsEngine..ctor(V8Settings settings)
--- End of inner exception stack trace ---
at JavaScriptEngineSwitcher.V8.V8JsEngine..ctor(V8Settings settings)
at JavaScriptEngineSwitcher.V8.V8JsEngineFactory.CreateEngine()
at React.JavaScriptEngineFactory.GetFactory(JsEngineSwitcher jsEngineSwitcher, Boolean allowMsie)
Error initialising React.VroomJsEngine+Factory: JavaScriptEngineSwitcher.Core.JsEngineLoadException: During loading of VroomJs JavaScript engine error has occurred.
See more details:
The type initializer for 'VroomJs.JsEngine' threw an exception. ---> System.TypeInitializationException: The type initializer for 'VroomJs.JsEngine' threw an exception. ---> System.DllNotFoundException: Unable to load DLL 'VroomJsNative': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at VroomJs.JsEngine.js_set_object_marshal_type(JsObjectMarshalType objectMarshalType)
at VroomJs.JsEngine..cctor()
--- End of inner exception stack trace ---
at VroomJs.JsEngine..ctor(Int32 maxYoungSpace, Int32 maxOldSpace)
at React.VroomJsEngine.<>c.<.cctor>b__23_0()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at System.Lazy`1.get_Value()
at React.VroomJsEngine.get_Engine()
at React.VroomJsEngine..ctor()
--- End of inner exception stack trace ---
at React.VroomJsEngine..ctor()
at React.VroomJsEngine.Factory.CreateEngine()
at React.JavaScriptEngineFactory.GetFactory(JsEngineSwitcher jsEngineSwitcher, Boolean allowMsie)
This error does not block me from running and testing the code.
Like I said, all I did recently was to update the VS 2017 software...I tried to do a wild search in the project for 'v8-ia32' but nothing found.
To fix these errors I did the following:
Make sure you install the JavaScriptEngineSwitcher.V8, JavaScriptEngineSwitcher.V8.Native.win-x86 and JavaScriptEngineSwitcher.V8.Native.win-x64.
(I didn't install JavaScriptEngineSwitcher.V8.Native.win-x86)
According to https://reactjs.net/getting-started/aspnet.html
edit the ReactConfig.cs, basically, I just added this
JsEngineSwitcher.Current.DefaultEngineName = V8JsEngine.EngineName;
JsEngineSwitcher.Current.EngineFactories.AddV8();
Rebuild the project.

reactjs.net - 'potential stack overflow detected' error

Since I've decided to switch to server-side rendering from client-side react, I began to create my components and use them in the app.
However I came across this error:
Unknown error (RangeError); potential stack overflow detected
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.ClearScript.ScriptEngineException: Unknown error (RangeError); potential stack overflow detected
And this is a part from the stack-trace
[ScriptEngineException: Unknown error (RangeError); potential stack overflow detected]
V8Exception.ThrowScriptEngineException(V8Exception* ) +169
Microsoft.ClearScript.V8.V8ContextProxyImpl.Execute(String gcDocumentName, String gcCode, Boolean evaluate, Boolean discard) +462
Microsoft.ClearScript.V8.<>c__DisplayClass1b.<Execute>b__19() +197
Microsoft.ClearScript.ScriptEngine.ScriptInvoke(Func`1 func) +70
Microsoft.ClearScript.V8.V8ScriptEngine.BaseScriptInvoke(Func`1 func) +49
Microsoft.ClearScript.V8.<>c__DisplayClass25`1.<ScriptInvoke>b__24() +45
Microsoft.ClearScript.V8.?A0x792c8756.LockCallback(Void* pvArg) +9
Microsoft.ClearScript.V8.V8ContextProxyImpl.InvokeWithLock(Action gcAction) +176
Microsoft.ClearScript.V8.V8ScriptEngine.ScriptInvoke(Func`1 func) +118
Microsoft.ClearScript.V8.V8ScriptEngine.Execute(String documentName, String code, Boolean evaluate, Boolean discard) +118
JavaScriptEngineSwitcher.V8.V8JsEngine.InnerEvaluate(String expression) +89
So I don't know what causes this error but I think it is some code that goes in a loop or something similar. Furthermore if I refresh the page this error goes away and if I continue to refresh intensively it shows up again which is very frustrating.
I was getting the same error (web app in azure) and after some investigation and tests, setting SetAllowMsieEngine to true did in fact fixed the issue also to me.
As Luke McGregor said, this seems to be an issue with V8ScriptEngine and using SetAllowMsieEngine does the job, however this method is latest version of react.net is deprecated and is recommended to "managed in the JavaScriptEngineSwitcher configuration".
So the solution I found so far is to switch js engine switcher by setting it directly in code:
JsEngineSwitcher engineSwitcher = JsEngineSwitcher.Instance;
engineSwitcher.EngineFactories
.AddChakraCore()
.AddMsie( new MsieSettings() { EngineMode = JsEngineMode.Auto } );
engineSwitcher.DefaultEngineName = ChakraCoreJsEngine.EngineName;
Like this I'm using ChakraCore engine rather than default V8 which was causing the error.
So far, during our performance tests with around 250 concurrent requests, we do not have this error anymore when previously in the same conditions for sure this error would have occurred.
This is a known issue, see https://github.com/reactjs/React.NET/issues/190
The work around is to not use V8 to do the render ie:
app.UseReact(config =>
{
config
// ..other configuration settings
.SetAllowMsieEngine(true);
});

TFS 2012 Exception Message: TF246021

I'm receiving the following error within TFS
Exception Message: TF246021: An error occurred while processing your
request. Technical information (for administrator): SQL Server Error:
2601 (type VersionControlException) Exception Stack Trace: Server
stack trace: at
Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply(TfsClientOperation
operation, TfsMessage message, Object[]& outputs) at
Microsoft.TeamFoundation.VersionControl.Client.Repository5.LabelItem(String
workspaceName, String workspaceOwner, VersionControlLabel label,
LabelItemSpec[] labelSpecs, LabelChildOption children, Int32
maxClientPathLength, Failure[]& failures) at
Microsoft.TeamFoundation.VersionControl.Client.WebServiceLayer.LabelItem(String
workspaceName, String workspaceOwner, VersionControlLabel label,
LabelItemSpec[] labelSpecs, LabelChildOption children, Failure[]&
failures) at
Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.CreateLabel(VersionControlLabel
label, LabelItemSpec[] itemSpecs, LabelChildOption options, Failure[]&
failures) at
Microsoft.TeamFoundation.Build.Workflow.Activities.TfLabel.TfLabelInternal.RunCommand(VersionControlScope
versionControlScope, String nonFatalError, VersionControlLabel label,
IEnumerable`1 items, LabelChildOption childOption) at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Object[]& outArgs) at
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage
msg, IMessageSink replySink)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message
reqMsg, Boolean bProxyCase) at
System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed,
MessageData& msgData) at System.Func6.EndInvoke(IAsyncResult
result) at
Microsoft.TeamFoundation.Build.Workflow.Activities.TfLabel.TfLabelInternal.EndExecute(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor
executor, BookmarkManager bookmarkManager)
Inner Exception Details:
Exception Message: TF246021: An error occurred while processing your
request. Technical information (for administrator): SQL Server Error:
2601 (type SoapException)SoapException Details: Exception
Stack Trace:
I've read a previous post within StackOverflow which points at recreating workspaces, I tried that and it doesn't work.
Also I've tried to clean the cache, again without any luck. One thing I noticed when I go and disable 'Label Sources' and run the a build it works. I believe its to do with creating a branch and then deleting some files from a main branch which then gets TFS into a mess. I'm not sure whats the best way to fix this, it'll be difficult to upgrade to a newer version of TFS.
Make sure your TFS 2012 has been upgraded to the latest edition Update 4.
Make sure the build server has the same edition with TFS Application Tier.
Make sure both client cache and server cache are cleaned. Client cache: C:\Users\username\AppData\Local\Microsoft\Team Foundation\4.0\Cache. Server cache: C:\ProgramData\Microsoft\Team Foundation\Web Access\Cache_v11.0
Check Event log in Event Viewer to see whether there is something helpful.

Cannot Insert image through Umbraco RichText editor

The problem regarding richtext editor in Umbraco 4.
I am not able to add images through the RichText editor. When i click on the add image icon on the rich text editor, the popup panel displays an error (find in resource number 2).
The RichText editor datatype is using Tinymce3 as its type.
The resources ihave used and did not solve the problem.
1) http://our.umbraco.org/forum/using/ui-questions/39103-Problem-with-Rich-Text-Editor-and-Inserting-Images
2) Rich Text Editor and Inserting Images getting error
What i have done(they did not work):
a) resaved the RichText editor datatype with different Type,
b) deleted the RichText editor(bad mistake) and recreated it,
c) copied the code of insertimage.aspx from different projects wherever the RichText editor is working,
Kindly, have a look at the error image i have attached with this question.
Any suggestion would be helpful.
Error
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1096afd0\6b67abfd\App_Web_uploadmediaimage.ascx.c3c18f9f.5y91thdt.0.cs Line: 0
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
umbraco.cms.businesslogic.datatype.DataTypeDefinition.b__0(DataTypeDefinition x) +235
System.Linq.WhereArrayIterator`1.MoveNext() +42
umbraco.cms.businesslogic.datatype.DataTypeDefinition.GetByDataTypeId(Guid DataTypeId) +311
umbraco.controls.Images.UploadMediaImage..ctor() +88
ASP.umbraco_controls_images_uploadmediaimage_ascx..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1096afd0\6b67abfd\App_Web_uploadmediaimage.ascx.c3c18f9f.5y91thdt.0.cs:0
ASP.umbraco_plugins_tinymce3_insertimage_aspx.__BuildControlMediaUploader() in c:\work\IU\trunk\src\International.Web.UI\umbraco\plugins\tinymce3\insertImage.aspx:187
ASP.umbraco_plugins_tinymce3_insertimage_aspx.__BuildControlpane_upload() in c:\work\IU\trunk\src\International.Web.UI\umbraco\plugins\tinymce3\insertImage.aspx:186
ASP.umbraco_plugins_tinymce3_insertimage_aspx.__BuildControlForm1() in c:\work\IU\trunk\src\International.Web.UI\umbraco\plugins\tinymce3\insertImage.aspx:150
ASP.umbraco_plugins_tinymce3_insertimage_aspx.__BuildControlTree(umbraco_plugins_tinymce3_insertimage_aspx __ctrl) in c:\work\IU\trunk\src\International.Web.UI\umbraco\plugins\tinymce3\insertImage.aspx:1
ASP.umbraco_plugins_tinymce3_insertimage_aspx.FrameworkInitialize() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1096afd0\6b67abfd\App_Web_insertimage.aspx.43b758d9.qhb5uafm.0.cs:0
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +67
System.Web.UI.Page.ProcessRequest() +118
System.Web.UI.Page.ProcessRequest(HttpContext context) +98
ASP.umbraco_plugins_tinymce3_insertimage_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\1096afd0\6b67abfd\App_Web_insertimage.aspx.43b758d9.qhb5uafm.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +912
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +164
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18033
Two things that spring to mind:
Permissions
I would do the usual housekeeping check first. Ensure that the following accounts have modify permission on all of the site's folders:
NETWORK SERVICE
IUSR
IIS_IUSRS
Corrupted install
A final resort would be a re-install. Copy over all the files from your version of Umbraco. If this still doesn't work, point it at a new database and try re-installing a basic Umbraco website.
The idea here is to determine if it is a corrupted database record, or a missing/corrupted file.
Is the site a new one? Have you always stuck with the same version or recently upgraded?
Let us know if you have your own answer too please. Best of luck!

protobuf-net transcoder for EnyimMemcached problems

Is the transcoder from protobuf-net to enyim cache deprecated? distributed caching with protobuff-net
Setting my Enyim config just like this app.config causes an error when I try to start the MemcachedClient()
The same for using
transcoder type="ProtoBuf.Caching.Enyim.NetTranscoder"/
System.TypeInitializationException was unhandled by user code
HResult=-2146233036
Message=The type initializer for 'Enyim.Caching.MemcachedClient' threw an exception.
Source=Enyim.Caching
TypeName=Enyim.Caching.MemcachedClient
StackTrace:
at Enyim.Caching.MemcachedClient..ctor()
at Global.asax.cs:line 31
InnerException: System.Configuration.ConfigurationErrorsException
HResult=-2146232062
Message=The value of the property 'transcoder' cannot be parsed. The error is: Object reference not set to an instance of an object. (\web.config line 207)
Source=System.Configuration
BareMessage=The value of the property 'transcoder' cannot be parsed. The error is: Object reference not set to an instance of an object.
StackTrace:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.HttpContext.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at Enyim.Caching.MemcachedClient..cctor() in MemcachedClient.cs:line 25
InnerException:
Both installed via nuget and using the latest version available.
Yes (cough), of course that's there! Just see "protobuf-net.Enyim", i.e.
PM> Install-Package protobuf-net.Enyim
(or use the GUI client)
To initialize, you need to configure the transcoder to be an instance of ProtoBuf.Caching.Enyim.NetTranscoder (as per the original instructions). If you are doing this via configuration, note that the assembly for this type is now protobuf-net.Enyim. If I assume the configuration file uses standard notation, then that means you would need to specify (in the config):
<transcoder type="ProtoBuf.Caching.Enyim.NetTranscoder,protobuf-net.Enyim" />
Original answer:
The enyim transcoder is not currently in nuget; however - I will right now take it upon myself to resurrect that, by adding a separate NuGet package (reference EnyimMemcached and protobuf-net) that adds this back in.
Random question... any chance you can point me at a binary memcached download for testing?
One reason this has lagged is that when I first wrote the enyim transcoder, memcached was a simple "run this" - but last time I looked it had gone all "enterprisey", and I couldn't track down a simple package that just had the memcached server. If you can show me where that is now, I'll get it working this weekend.

Resources