Last post Dec 05, 2017 11:54 AM by gtscdsi
Nov 10, 2017 06:38 AM|pointtoshare|LINK
I have a MVC 5 Razor application running on IIS. This application was running under the root site. For some reasons I had to move it under an existing site as a sub site. After moving a site as a sub-site the HTML helper got red under lined when I open it
in Visual Studio 2013. I cannot use the HTML helper properties also. Could anybody please help?
Thanks in advance.
Nov 10, 2017 08:18 AM|zxj|LINK
I have a MVC 5 Razor application running on IIS. This application was running under the root site. For some reasons I had to move it under an existing site as a sub site. After moving a site as a sub-site the HTML helper got red under lined when I open it in
Visual Studio 2013. I cannot use the HTML helper properties also. Could anybody please help?
The issue is likely to be a bad component model cache.
You can resolve it by deleting the cache files located in:
The files will be recreated when you next launch Visual Studio, and they should now be no error.
Nov 13, 2017 06:37 AM|pointtoshare|LINK
Hi, I have removed everything in ComponentModelCache folder but still get the red underlines under html helpers on razor views.
Nov 13, 2017 09:36 AM|zxj|LINK
Could you update all of NuGet stuff to the latest version (you might need to do this in VS2013 if you are experiencing the Nuget)?
Fix MVC versions and its child libraries to the new version (expand the
References then right click on Sytem.Web.MVC then
Properties to get your version).
Use Package Manager to insatll the new version
Install-Package Microsoft.AspNet.Mvc -Version 5.2.3
I have found that it is sometimes better to have VS create a new MVC project, then look at and compare the web.configs (both application root as well as the views folder web.config) that it generates to your project's configuration files to ensure that you
are not including namespaces that don't belong and all version numbers are correct.
Nov 15, 2017 07:05 AM|AngelinaJolie|LINK
I had to move it under an existing site as a sub site
Method 1: Make these two project under the same one solution ;
1>add a folder under solution
2> add the current existing subproject to your project in VS,
3> then publish.it will fix this question;
For some reasons
Method 2: I guess that you want to avoid using multiple ports.
if so, I suggest that you could parse multiple subdomains;
www.yoursite.com is for the main site;
susite.yoursite.com is for the subsite;
Hope it is helpful to you.
Nov 16, 2017 03:47 AM|pointtoshare|LINK
Thanks for your response.
I cannot make both as one solution because, I have to deploy two apps in two different sites for some reasons and also, multiple subdomains are not possible in my context. your suggestions are very practical but unfortunately, cannot implement in the middle
of this context.
Nov 16, 2017 04:22 AM|pointtoshare|LINK
All NuGet stuffs are already updated to the latest versions. MVC version is also the latest one (18.104.22.168). I have created a new project and didn't get anything unmatched.
The strange thing happening here- not all html helpers are red underlined, some are fresh, some are red underlined in @Html.ValidationMessageFor but @Html.EditorFor is fresh. And, sometimes the red underlines do not come very beginning, it comes after working
sometimes but not sure after which action it comes.
What I found is- I have included NuGet packages into the App1Web project not into the App1 project. Should I include the packages for both host web and app web?
One more thing is happening, I don't know whether it is related to this issue or not- When I open the project in VS 2013 the root site path in IIS is changed to this opened project path. Say like- My root site is AppStore (Path: C:\inetpub\wwwroot\AppStore)
and two subsites are App1 and App2. When I open App1 in VS, the root site path is changed into C:\inetpub\wwwroot\AppStore\App1\App1Web
Thanks for your all supports.
Nov 17, 2017 02:37 AM|AngelinaJolie|LINK
Could you tell us more information, I need to know what you did and the specified error message.
1, What you did to make the other site as the subsite
2, After one site as subsite to another, does it work as expected?can it be viewed at the browser directly?
3, Besides, “red under line in VS”, is it error or warning?
4, Are they the alone working sites before?Just after as subsite, then there is something error occurs?
5, I have a guess, please check the web.config inside the Views folder and make sure these namespaces, or pageBaseType,
or version right.
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
The host -> factoryType was set to version:126.96.36.199 hope this helps anyone from https://stackoverflow.com/questions/12041633/razor-views-not-seeing-system-web-mvc-htmlhelper
More information could help us get the real point for your question.
Nov 17, 2017 10:57 AM|pointtoshare|LINK
Here are the information:
Nov 20, 2017 07:50 AM|AngelinaJolie|LINK
I have created a site under "Sites" (C:\inetpub\wwwroot\AppStore) in IIS and bind with port 443 and host name "https://myapps.org" with a self signed certificate. Then I created two subsite under "AppStore" and those are "App1" (C:\inetpub\wwwroot\AppStore\App1) and
"App2" ((C:\inetpub\wwwroot\AppStore\App2). All sites use the same AppPool and certificate.
Normally, it must work, after you add a virtual directory and convert it to an application if you don't delete something default view file.
Red underlines are error. This error comes for the EdotorFor html helper: "The type of arguments for method 'System.Web.MVC.Html.EditorExtensions.EditorFor<TModel,TValue>System.Web.MVC.HtmlHelper<Tmodel>,System.Linq.Expressions.Expression<System.Func<TModel,TValue>>,string)'
cannot be inferred for the usage. Try specifying the type arguments explicitly."
I found some guess, please have a try:
The able solution,
In the web.config file :
<compilation debug="true" targetFramework="4.0">
More able solution https://stackoverflow.com/questions/4969321/the-type-arguments-cannot-be-inferred-from-the-usage-try-specifying-the-type-ar
Bests, Angelina Jolie
Nov 21, 2017 08:20 AM|pointtoshare|LINK
Thanks for your suggestions. I already did it earlier i.e. <compilation
but the difference is, in my case the targetFramework is 4.5 instead of 4.0 <compilation
Does it matter any way?
Dec 05, 2017 11:54 AM|gtscdsi|LINK
It depends on your .NET framework installed version, When the application is targeted to 4.5, Visual Studio modifies the configuration
file. There are two related concepts in the<supportedRuntime> element:
runtime version and target SKU. The .NET Framework 4.5 SKU rides on top of version 4.0 of the CLR. When a component in the
.NET Framework needs to decide whether to apply quirks behavior to a particular code path or whether it should use new 4.5-standards logic, it consults the [TargetFramework]
attribute to see what framework version the application targets, hence what logic it expects to take place. (If the attribute
is not present, the runtime assumes 4.0 quirks behavior.
Your question falls into a category which requires a more in-depth level of support. Please visit the below link to see the various free and paid support options that are available to better meet your needs.