Reputation: 829
I am trying to run my website on iis installed on my local computer.
I have installed vs 2017 on my windows 10 computer.
I can build the application properly in my visual studio
but when i hosted the application on iis . I gave below error
From th error it is clear the dotnet framework installed on my system doesnpt support c# 6 and this code is written in version more than c# 5.
I don't understand why i am getting this error. As i installed vs 2017 so it should install the required dotnet framework in my system.
Here is complete error
**
Line 22:
Line 23: <div class="hero hero--feature v-spacing--bottom" style="@editingStyle">
Line 24: @if (Model?.Image != null)
Line 25: {
Line 26: <div class="hero__img-wrap">
Source File: c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml Line: 24
Show Detailed Compiler Output:
c:\windows\system32\inetsrv> "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\817eb37e\7ee7a906\assembly\dl3\01421c3a\00f8b9b5_c1fbd301\Microsoft.Extensions.Logging.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\817eb37e\7ee7a906\assembly\dl3\6aae1c9a\00f8b9b5_c1fbd301\ChilkatDotNet46.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\817eb37e\7ee7a906\assembly\dl3\4508a46e\00f8b9b5_c1fbd301\System.Net.Http.Extensions.Compression.Core.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\817eb37e\7ee7a906\assembly\dl3\eb9664b4\00f8b9b5_c1fbd301\Lucene.Net.Contrib.FastVectorHighlighter.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\817eb37e\7ee7a906\assembly\dl3\c406a713\00f8b9b5_c1fbd301\Sitecore.Marketing.Operations.Xdb.ReferenceData.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\817eb37e\7ee7a906\assembly\dl3\0e8d6c8a\00f8b9b5_c1fbd301\Microsoft.AspNet.Identity.Core.dll" /R:"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\817eb37e\7ee7a906\assembly\dl3\93060520\00c8bed1_a7e8d301\System.Web.WebPages.Razor.dll" --------------------------"
Microsoft (R) Visual C# Compiler version 4.7.3190.0
for C# 5
Copyright (C) Microsoft Corporation. All rights reserved.
This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml(24,16): error CS1525: Invalid expression term '.'
c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml(24,17): error CS1003: Syntax error, ':' expected
c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml(24,30): error CS1002: ; expected
c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml(24,30): error CS1525: Invalid expression term ')'
c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml(24,31): error CS1002: ; expected
c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml(39,5): error CS1525: Invalid expression term 'else'
c:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml(39,9): error CS1002: ; expected
Show Complete Compilation Source:
Line 1: #pragma checksum "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "42D6EA687014FCED881086CE91019FBE57FDCC15"
Line 2: //------------------------------------------------------------------------------
Line 3: // <auto-generated>
Line 4: // This code was generated by a tool.
Line 5: // Runtime Version:4.0.30319.42000
Line 6: //
Line 7: // Changes to this file may cause incorrect behavior and will be lost if
Line 8: // the code is regenerated.
Line 9: // </auto-generated>
Line 10: //------------------------------------------------------------------------------
Line 11:
Line 12: namespace ASP {
Line 13: using System;
Line 14: using System.Collections.Generic;
Line 15: using System.IO;
Line 16: using System.Linq;
Line 17: using System.Net;
Line 18: using System.Web;
Line 19: using System.Web.Helpers;
Line 20: using System.Web.Security;
Line 21: using System.Web.UI;
Line 22: using System.Web.WebPages;
Line 23: using System.Web.Mvc;
Line 24: using System.Web.Mvc.Ajax;
Line 25: using System.Web.Mvc.Html;
Line 26: using System.Web.Routing;
Line 27: using Sitecore.Mvc;
Line 28: using Sitecore.Mvc.Presentation;
Line 29:
Line 30: #line 1 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 31: using Feature.Hero;
Line 32:
Line 33: #line default
Line 34: #line hidden
Line 35:
Line 36: #line 2 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 37: using Foundation.GlassMapper.Extensions;
Line 38:
Line 39: #line default
Line 40: #line hidden
Line 41:
Line 42: #line 3 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 43: using System.Collections.Specialized;
Line 44:
Line 45: #line default
Line 46: #line hidden
Line 47:
Line 48:
Line 49: public class _Page_Views_Hero_HeroFeature_cshtml : Glass.Mapper.Sc.Web.Mvc.GlassView<Feature.Hero.Models.HeroFeatureModel> {
Line 50:
Line 51: #line hidden
Line 52:
Line 53: public _Page_Views_Hero_HeroFeature_cshtml() {
Line 54: }
Line 55:
Line 56: protected ASP.global_asax ApplicationInstance {
Line 57: get {
Line 58: return ((ASP.global_asax)(Context.ApplicationInstance));
Line 59: }
Line 60: }
Line 61:
Line 62: public override void Execute() {
Line 63:
Line 64: #line 5 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 65:
Line 66: NameValueCollection parameters = new NameValueCollection();
Line 67: parameters.Add("class", "hero__picture");
Line 68: parameters.Add("imgClass", "hero__img");
Line 69: string editingStyle = "";
Line 70: string editDivStyle = @" background-color: black;
Line 71: color: white;
Line 72: font-size: 20px;
Line 73: float: right;
Line 74: text-align: center;
Line 75: line-height: 3;
Line 76: width:290px";
Line 77: if (IsInEditingMode)
Line 78: {
Line 79: editingStyle = "min-height:300px;";
Line 80: }
Line 81:
Line 82:
Line 83: #line default
Line 84: #line hidden
Line 85: WriteLiteral("\r\n\r\n<div");
Line 86:
Line 87: WriteLiteral(" class=\"hero hero--feature v-spacing--bottom\"");
Line 88:
Line 89: WriteAttribute("style", Tuple.Create(" style=\"", 748), Tuple.Create("\"", 769)
Line 90:
Line 91: #line 23 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 92: , Tuple.Create(Tuple.Create("", 756), Tuple.Create<System.Object, System.Int32>(editingStyle
Line 93:
Line 94: #line default
Line 95: #line hidden
Line 96: , 756), false)
Line 97: );
Line 98:
Line 99: WriteLiteral(">\r\n");
Line 100:
Line 101:
Line 102: #line 24 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 103:
Line 104:
Line 105: #line default
Line 106: #line hidden
Line 107:
Line 108: #line 24 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 109: if (Model?.Image != null)
Line 110: {
Line 111:
Line 112:
Line 113: #line default
Line 114: #line hidden
Line 115: WriteLiteral(" <div");
Line 116:
Line 117: WriteLiteral(" class=\"hero__img-wrap\"");
Line 118:
Line 119: WriteLiteral(">\r\n");
Line 120:
Line 121:
Line 122: #line 27 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 123:
Line 124:
Line 125: #line default
Line 126: #line hidden
Line 127:
Line 128: #line 27 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 129: if (IsInEditingMode)
Line 130: {
Line 131:
Line 132:
Line 133: #line default
Line 134: #line hidden
Line 135: WriteLiteral(" <picture");
Line 136:
Line 137: WriteLiteral(" class=\"hero__picture\"");
Line 138:
Line 139: WriteLiteral(">\r\n <img");
Line 140:
Line 141: WriteLiteral(" class=\"hero__img\"");
Line 142:
Line 143: WriteAttribute("src", Tuple.Create(" src=\"", 991), Tuple.Create("\"", 1013)
Line 144:
Line 145: #line 30 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 146: , Tuple.Create(Tuple.Create("", 997), Tuple.Create<System.Object, System.Int32>(Model.Image.Src
Line 147:
Line 148: #line default
Line 149: #line hidden
Line 150: , 997), false)
Line 151: );
Line 152:
Line 153: WriteLiteral(" alt=\"Hero Image\"");
Line 154:
Line 155: WriteLiteral(">\r\n </picture>\r\n");
Line 156:
Line 157:
Line 158: #line 32 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 159: }
Line 160: else
Line 161: {
Line 162:
Line 163:
Line 164: #line default
Line 165: #line hidden
Line 166:
Line 167: #line 35 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 168: Write(ImageExtensions.RenderResponsivePicture(Model, x => x.Image, false, parameters));
Line 169:
Line 170:
Line 171: #line default
Line 172: #line hidden
Line 173:
Line 174: #line 35 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 175: ;
Line 176: }
Line 177:
Line 178:
Line 179: #line default
Line 180: #line hidden
Line 181: WriteLiteral(" </div>\r\n");
Line 182:
Line 183:
Line 184: #line 38 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 185: }
Line 186: else
Line 187: {
Line 188: using (BeginEditFrame(Constants.EditorFramePaths.Image, Model.FullPath))
Line 189: {
Line 190: Editable(x => x.Image);
Line 191:
Line 192:
Line 193:
Line 194: #line default
Line 195: #line hidden
Line 196: WriteLiteral(" <div");
Line 197:
Line 198: WriteAttribute("style", Tuple.Create(" style=\"", 1412), Tuple.Create("\"", 1433)
Line 199:
Line 200: #line 45 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 201: , Tuple.Create(Tuple.Create("", 1420), Tuple.Create<System.Object, System.Int32>(editDivStyle
Line 202:
Line 203: #line default
Line 204: #line hidden
Line 205: , 1420), false)
Line 206: );
Line 207:
Line 208: WriteLiteral(">Add an Image to article</div>\r\n");
Line 209:
Line 210:
Line 211: #line 46 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 212: }
Line 213: }
Line 214:
Line 215:
Line 216: #line default
Line 217: #line hidden
Line 218: WriteLiteral(" <div");
Line 219:
Line 220: WriteLiteral(" class=\"hero__heading-wrap\"");
Line 221:
Line 222: WriteLiteral(">\r\n");
Line 223:
Line 224:
Line 225: #line 49 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 226:
Line 227:
Line 228: #line default
Line 229: #line hidden
Line 230:
Line 231: #line 49 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 232: if (Model != null)
Line 233: {
Line 234:
Line 235:
Line 236: #line default
Line 237: #line hidden
Line 238: WriteLiteral(" <h1");
Line 239:
Line 240: WriteLiteral(" class=\"h1 hero__h1\"");
Line 241:
Line 242: WriteLiteral(">Top Stories</h1>\r\n");
Line 243:
Line 244:
Line 245: #line 52 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 246:
Line 247:
Line 248:
Line 249: #line default
Line 250: #line hidden
Line 251: WriteLiteral(" <a");
Line 252:
Line 253: WriteLiteral(" class=\"hero__tag tag link\"");
Line 254:
Line 255: WriteAttribute("href", Tuple.Create(" href=\"", 1659), Tuple.Create("\"", 1699)
Line 256:
Line 257: #line 53 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 258: , Tuple.Create(Tuple.Create("", 1666), Tuple.Create<System.Object, System.Int32>(Model.SubtopicPage.TopicPage.Url
Line 259:
Line 260: #line default
Line 261: #line hidden
Line 262: , 1666), false)
Line 263: );
Line 264:
Line 265: WriteLiteral(">");
Line 266:
Line 267:
Line 268: #line 53 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 269: Write(Model.SubtopicPage.TopicPage.GetName);
Line 270:
Line 271:
Line 272: #line default
Line 273: #line hidden
Line 274: WriteLiteral("</a>\r\n");
Line 275:
Line 276:
Line 277: #line 54 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 278:
Line 279: if (Model.Url != null)
Line 280: {
Line 281:
Line 282:
Line 283: #line default
Line 284: #line hidden
Line 285: WriteLiteral(" <a");
Line 286:
Line 287: WriteLiteral(" class=\"link link--black\"");
Line 288:
Line 289: WriteAttribute("href", Tuple.Create(" href=\"", 1840), Tuple.Create("\"", 1857)
Line 290:
Line 291: #line 57 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 292: , Tuple.Create(Tuple.Create("", 1847), Tuple.Create<System.Object, System.Int32>(Model.Url
Line 293:
Line 294: #line default
Line 295: #line hidden
Line 296: , 1847), false)
Line 297: );
Line 298:
Line 299: WriteLiteral(">\r\n <h2");
Line 300:
Line 301: WriteLiteral(" class=\"h2 h2--black hero__h2\"");
Line 302:
Line 303: WriteLiteral(">");
Line 304:
Line 305:
Line 306: #line 58 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 307: Write(Html.Raw(Model.Title));
Line 308:
Line 309:
Line 310: #line default
Line 311: #line hidden
Line 312: WriteLiteral("</h2>\r\n </a>\r\n");
Line 313:
Line 314:
Line 315: #line 60 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 316: }
Line 317: else
Line 318: {
Line 319:
Line 320:
Line 321: #line default
Line 322: #line hidden
Line 323: WriteLiteral(" <h2");
Line 324:
Line 325: WriteLiteral(" class=\"h2 h2--black hero__h2\"");
Line 326:
Line 327: WriteLiteral(">");
Line 328:
Line 329:
Line 330: #line 63 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 331: Write(Html.Raw(Model.Title));
Line 332:
Line 333:
Line 334: #line default
Line 335: #line hidden
Line 336: WriteLiteral("</h2>\r\n");
Line 337:
Line 338:
Line 339: #line 64 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 340: }
Line 341: }
Line 342: else
Line 343: {
Line 344: if (IsInEditingMode)
Line 345: {
Line 346:
Line 347:
Line 348: #line default
Line 349: #line hidden
Line 350: WriteLiteral(" <div");
Line 351:
Line 352: WriteAttribute("style", Tuple.Create(" style=\"", 2213), Tuple.Create("\"", 2234)
Line 353:
Line 354: #line 70 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 355: , Tuple.Create(Tuple.Create("", 2221), Tuple.Create<System.Object, System.Int32>(editDivStyle
Line 356:
Line 357: #line default
Line 358: #line hidden
Line 359: , 2221), false)
Line 360: );
Line 361:
Line 362: WriteLiteral(">Add an article</div>\r\n");
Line 363:
Line 364:
Line 365: #line 71 "C:\inetpub\wwwroot\xp0.sc\Views\Hero\HeroFeature.cshtml"
Line 366: }
Line 367: }
Line 368:
Line 369:
Line 370: #line default
Line 371: #line hidden
Line 372: WriteLiteral(" </div>\r\n</div>\r\n");
Line 373:
Line 374: }
Line 375: }
Line 376: }
Line 377:
**
Can anyone please suggest me what I need to do.
Thank you
Upvotes: 2
Views: 2897
Reputation: 829
After a lot of searches I was able to find the solution of this error.
First of all we need to verify that if we are having correct .net framework installed which supports c# 6 in our system
then we can write the below configuration in our web.config file just above the end of configuration tag
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
It solved my issue, Hope it will help others too
Upvotes: 3
Reputation: 4119
You are using Null-Conditional Operator that is a feature of C# 6. Run the msbuild over your solution, if it compiles properly you have all your framework dependencies covered, if not, fix the error, install the framework(but it doesn't seem for that for me because it is compiling on your VisualStudio)
After that check the configuration of your application pool, it should work with v4.0 in classic mode. Hope this helps
Upvotes: 0