在包含 csc.exe 文件的 smarterasp.net 上发布网站时出现问题? [英] Problems publishing a website on smarterasp.net with csc.exe file included?

查看:19
本文介绍了在包含 csc.exe 文件的 smarterasp.net 上发布网站时出现问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Microsoft Visual Studio 2015,我使用 C# 联系表构建了一个简单的网站.当我在 localhost 上编译和运行时,它工作得很好.但是,当我尝试发布它(在 smarterasp.net 上)时,我收到一个错误:

I am using Microsoft Visual Studio 2015, I built a simple website with a C# contact form. When I compile and run on localhost it works perfectly fine. However, when I try to publish it (on smarterasp.net) I am getting an error:

[Win32Exception (0x80004005): 访问被拒绝]

[Win32Exception (0x80004005): Access is denied]

[ExternalException (0x80004005): 无法执行程序.正在执行的命令是..in oslyncsc.exe"

[ExternalException (0x80004005): Cannot execute a program. The command being executed was "..in oslyncsc.exe"

我联系过 smarterasp.net,他们说他们不允许 .exe 文件.我试图从服务器上使用 ftp 删除 csc.exe,但是当我这样做时,我收到错误:

I have contacted smarterasp.net and they said they dont allow .exe files. I tried to delete csc.exe with ftp from the server but when I do that I am getting the error:

找不到文件..in oslyncsc.exe".

Could not find file "..in oslyncsc.exe".

如何使用试图包含在我的项目中的 csc.exe 解决此问题,以便发布我的网站?

How can I solve this issue with the csc.exe that is trying to get included in my project so I can get my this website published?

推荐答案

经过数小时的研究,我想出了解决方案.

After hours of researching i came up with the solution.

从 .NET 4.5 版本开始,Roslyn 编译是默认的编译方式.这意味着,如果您使用 .NET 4.5 创建任何 Web 应用程序,无论是 Web 窗体还是 MVC,您都会在项目中预安装此 Roslyn csc.exe 编译.

Since the .NET 4.5 version, Roslyn compilation is the default way of compiling. This means if you create any web application either Web Forms or MVC using .NET 4.5 you get this Roslyn csc.exe compilation pre-installed in your project.

基本上我需要的是在没有 Roslyn 或任何 .exe 文件的情况下编译和部署我的项目.

Basically what i needed was to compile and deploy my project without Roslyn or any .exe files on it.

所以这是对我有用的解决方案.您可以在没有 Roslyn 的情况下进行部署,而无需更改代码:

So here is the Solution that worked for me. You can deploy without Roslyn with no change in code:

  1. 打开 NuGet 包管理器窗口
  2. 卸载 Microsoft.CodeDom.Providers.DotNetCompilerPlatform 包并重建 &重新发布.(此卸载还会从 web.config 文件中删除 CodeDom 配置.)
  1. Open NuGet Package Manager window
  2. uninstall Microsoft.CodeDom.Providers.DotNetCompilerPlatform package and rebuild & republish. (This uninstallation also removes CodeDom configuration from web.config file.)

这将解决您的目的.基本上这不会在 bin 文件夹中生成任何 csc.exe、vbc.exe 文件.

This will solve your purpose. Basically this will not generate any csc.exe, vbc.exe files inside bin folder.

我希望它也适用于您!

这篇关于在包含 csc.exe 文件的 smarterasp.net 上发布网站时出现问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆