runTime error 服务器错误

本文解决了服务器上因自定义错误设置而导致无法查看详细错误信息的问题,并分享了解决由相对路径引起的部署问题的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这个服务器错误已经捆饶我两三天了,至今没有解决,偶的经验还是很少,要继续多多积累!

错误如下:

  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>

Server Error in '/' Application.

Runtime Error

 原来这个提示是说webconfig的配置  <customErrors     mode="RemoteOnly"  /> 应该修改为mode="Off" ,这样才能显示服务器错误信息。

经过排查发现错误出在 相对路径的获取上,

因为在vs下编写代码的时候,网站是在IIS -〉默认网站-〉虚拟目录下,而在部署服务器的时候,网站被放在服务器的IIS -〉默认网站下,所以获取路径就出了问题。

解决方法:

在项目定义常量,编写代码的时候用原来的获取方式,部署服务器的时候把常量替换。

现在只能这么解决,等以后有了好办法我再写上来。

### Linux服务器上CUDA不可用问题解决方案 对于Linux服务器上报错`RuntimeError: No CUDA GPUs are available`的情况,可以按照以下方法排查并解决问题。 #### 验证PyTorch是否能识别GPU 确认PyTorch能否检测到GPU设备是一个重要的初步检查。可以通过Python脚本执行如下命令来验证: ```python import torch print(torch.cuda.is_available()) print(torch.cuda.device_count()) ``` 如果上述代码返回False和0,则表示当前环境中PyTorch未能成功找到任何可用的GPU资源[^1]。 #### 检查CUDA安装状态 确保CUDA已经在Linux系统中正确安装,并且能够正常工作。通过终端输入nvcc --version指令查询CUDA编译器版本号,以此判断CUDA是否存在以及其具体版本。例如,在一个成功的安装环境下,该命令应当显示类似于下面的信息: ``` nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2023 NVIDIA Corporation Built on Wed_Sep_27_19:36:35_PDT_2023 Cuda compilation tools, release 11.8, V11.8.89 Build cuda_11.8.r11.8/compiler.34283773_0 ``` 这表明CUDA已经被正确部署到了操作系统内[^2]。 #### 核实CUDA与PyTorch版本兼容性 为了使CUDA和PyTorch协同运作良好,两者之间的版本需保持一致或至少相互支持。比如当使用的CUDA版本为11.8时,对应的PyTorch版本应选择与其相匹配的一个稳定版(如2.0.0)。可通过官方文档获取详细的版本对应表,并利用pip工具重新安装适当版本的PyTorch库以确保最佳性能表现。 #### 排除驱动程序冲突 有时即使硬件本身具备NVIDIA GPU,但由于显卡驱动未更新至最新版本或是存在其他软件层面的因素干扰,也可能导致无法正常使用CUDA功能。建议定期访问[NVIDIA官方网站](https://www.nvidia.com/)下载最新的图形驱动包进行升级操作;同时注意清除旧有的残留文件以免造成不必要的麻烦。 经过以上几个方面的仔细核查之后,通常情况下应该能够有效定位并修复关于“无可用CUDA GPU”的错误提示信息了。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值