Prosty formularz lokalnie działa a po publikacji już nie - bład runtime

0

Cześć,
tak dla nauki napisałem sobie banalny formularz w asp.net mvc i go opublikowałem. Publikacja poszła dobrze natomiast kiedy chcę wejść na stronę to dostaję taki komunikat:

Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="Off"/>
    </system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->

<configuration>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
</configuration>

O co mu chodzi i jak to naprawić?

0

Dodałem ten wpis w pliku webconfig:

<customErrors mode="Off"/>

To teraz wywala:

 Access is denied
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.ComponentModel.Win32Exception: Access is denied

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:


[Win32Exception (0x80004005): Access is denied]

[ExternalException (0x80004005): Cannot execute a program. The command being executed was "h:\root\home\wesolykrokodyl-001\www\site1\bin\roslyn\csc.exe" /shared /keepalive:"10" /noconfig  /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\3fce8d61\89f0cf8e\qnnlg5j3.cmdline".]
   System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) +6978412
   System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName, String trueCmdLine) +115
   System.CodeDom.Compiler.Executor.ExecWaitWithCapture(IntPtr userToken, String cmd, String currentDir, TempFileCollection tempFiles, String& outputName, String& errorName) +81
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.Compile(CompilerParameters options, String compilerFullPath, String arguments, String& outputFile, Int32& nativeReturnValue) +193
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.FromFileBatch(CompilerParameters options, String[] fileNames) +680
   Microsoft.CodeDom.Providers.DotNetCompilerPlatform.Compiler.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames) +186
   System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerParameters options, String[] fileNames) +24
   System.Web.Compilation.AssemblyBuilder.Compile() +950
   System.Web.Compilation.BuildProvidersCompiler.PerformBuild() +10099549
   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +9994932
   System.Web.Compilation.BuildManager.CompileGlobalAsax() +44
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +260

[HttpException (0x80004005): Cannot execute a program. The command being executed was "h:\root\home\wesolykrokodyl-001\www\site1\bin\roslyn\csc.exe" /shared /keepalive:"10" /noconfig  /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\3fce8d61\89f0cf8e\qnnlg5j3.cmdline".]
   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +62
   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +435
   System.Web.Compilation.BuildManager.CallAppInitializeMethod() +33
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +545

[HttpException (0x80004005): Cannot execute a program. The command being executed was "h:\root\home\wesolykrokodyl-001\www\site1\bin\roslyn\csc.exe" /shared /keepalive:"10" /noconfig  /fullpaths @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\3fce8d61\89f0cf8e\qnnlg5j3.cmdline".]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9963380
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

1

Najmniej inwazyjny sposób naprawy to usunięcie sekcji "system.codedom" z pliku Web.config http://stackoverflow.com/a/36291441

0

Czy masz poprawnie skonfigurowanego IIS? Kliknij prawym przyciskiej -> Dodaj aplikacje. Następnie koonwertuj do aplikacji. Później kliknij w oknie IIS Przeglądaj. Powinna się odpalić strona na localhost

1

reptile333 zrobiłem tak jak napisałeś i apka zadziałała po opublikowaniu :) Dzięki!!!

MateuszDevVideo apka od początku na localhoście działała dobrze, dopiero po publikacji w necie był problem ale już go usunąłem.

0

Dodam jeszcze jedno pytanko w tym temacie...
Jak zrobić przechodzenie między stronami - widokami?
Mam sobie widok główny w Index.cshtml i w nim mam przycisk:
<input type="submit" value="Przejdź do formularza zakupów">

Chcę teraz po naciśnięciu tego przycisku przejść na stronę z formularzem FormContact.cshtml i dopiero na tej formie wypełnić sobie formularz.

Jak zrobić to przejście żeby ten baton reagował na klik?

0

<input type="button" value="Przejdź do formularza zakupów" onclick="location.href='@Url.Action("Widok", "Controller")'" />

choć lepszym sposobem

@Html.ActionLink("Opis", "Widok", Controller")

1 użytkowników online, w tym zalogowanych: 0, gości: 1