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>

Server Error in '/' Application.

Runtime Error

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

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

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

解决方法:

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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
引用\[1\]中提到了在服务器上跑网络时感觉很慢,尤其是在多块显卡同时运行时,尝试设置num_workers=4时出现了RuntimeError: Caught RuntimeError in DataLoader worker process的错误。这个错误通常是由于在多进程环境下使用了CUDA导致的。引用\[2\]中提到了另外一个报错信息RuntimeError: Cannot re-initialize CUDA in forked subprocess。这个错误提示表明在子进程中重新初始化CUDA会导致问题。根据这两个报错信息,可以推测出问题可能是由于在多进程环境下使用了CUDA并且尝试重新初始化CUDA导致的。 解决这个问题的方法是在创建DataLoader时将参数pin_memory设置为True,并且在创建DataLoader之前调用torch.cuda.set_device函数将当前设备设置为所需的GPU设备。这样可以确保在多进程环境下正确使用CUDA。另外,还可以尝试将num_workers设置为0,这样可以避免使用多进程,但可能会影响数据加载的速度。 总结起来,解决RuntimeError: Caught RuntimeError in DataLoader worker process的方法是: 1. 在创建DataLoader时将参数pin_memory设置为True。 2. 在创建DataLoader之前调用torch.cuda.set_device函数将当前设备设置为所需的GPU设备。 3. 将num_workers设置为0,以避免使用多进程。 希望这些方法能够帮助您解决问题。\[1\]\[2\] #### 引用[.reference_title] - *1* *2* [DataLoader设置num_workers=4报错 RuntimeError: Caught RuntimeError in DataLoader worker process](https://blog.csdn.net/qq_41381865/article/details/118459068)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [RuntimeError: applying transform <monai.transforms.croppad.dictionary.RandCropByPosNegLabeld object](https://blog.csdn.net/weixin_40198079/article/details/125423213)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值