WebRequest.Create(url)无效的URI:无效端口指定的URL时

本文描述了一种在文件下载到流时遇到的“无效的URI:指定的端口无效”的异常情况,并提供了解决方案,即通过将URL中的反斜杠替换为正斜杠来修正。
部署运行你感兴趣的模型镜像
异常信息:无效的 URI: 指定的端口无效
今天做文件下载到流时,WebRequest.Create(url)一直报错: 无效的 URI: 指定的端口无效,搞了两个小时没整好!最后发现是传入的URL不规范“http://201.23.32.43:23\\upload/content/27384.pdf”
解决办法:最后把这个URL.replace("\\","/"),再WebRequest.Create(url)解决问题

转载于:https://www.cnblogs.com/wjslw/p/10171184.html

您可能感兴趣的与本文相关的镜像

ACE-Step

ACE-Step

音乐合成
ACE-Step

ACE-Step是由中国团队阶跃星辰(StepFun)与ACE Studio联手打造的开源音乐生成模型。 它拥有3.5B参数量,支持快速高质量生成、强可控性和易于拓展的特点。 最厉害的是,它可以生成多种语言的歌曲,包括但不限于中文、英文、日文等19种语言

Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: 2025-11-04 16:21:10,095:WARNING:superset.views.error_handling:SupersetErrorsException Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: Traceback (most recent call last): Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/superset/commands/database/test_connection.py", line 176, in run Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: raise DBAPIError(ex_str or None, None, None) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: sqlalchemy.exc.DBAPIError: (builtins.NoneType) None Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: [SQL: (pyodbc.OperationalError) ('08001', '[08001] [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:0A000102:SSL routines::unsupported protocol] (-1) (SQLDriverConnect)') Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: (Background on this error at: https://sqlalche.me/e/14/e3q8)] Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: (Background on this error at: https://sqlalche.me/e/14/dbapi) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: The above exception was the direct cause of the following exception: Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: Traceback (most recent call last): Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/venv/lib/python3.10/site-packages/flask/app.py", line 1484, in full_dispatch_request Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: rv = self.dispatch_request() Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/venv/lib/python3.10/site-packages/flask/app.py", line 1469, in dispatch_request Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/venv/lib/python3.10/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: return f(self, *args, **kwargs) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/superset/views/base_api.py", line 120, in wraps Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: duration, response = time_function(f, self, *args, **kwargs) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/superset/utils/core.py", line 1369, in time_function Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: response = func(*args, **kwargs) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/superset/utils/log.py", line 304, in wrapper Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: value = f(*args, **kwargs) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/superset/views/base_api.py", line 92, in wraps Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: return f(self, *args, **kwargs) Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/superset/databases/api.py", line 1204, in test_connection Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: TestConnectionDatabaseCommand(item).run() Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: File "/home/gapinyc/superset/superset/commands/database/test_connection.py", line 205, in run Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: raise SupersetErrorsException(errors) from ex Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: superset.exceptions.SupersetErrorsException: [SupersetError(message="(builtins.NoneType) None\n[SQL: (pyodbc.OperationalError) ('08001', '[08001] [Microsoft][ODBC Driver 17 for SQL Server]SSL Provider: [error:0A000102:SSL routines::unsupported protocol] (-1) (SQLDriverConnect)')\n(Background on this error at: https://sqlalche.me/e/14/e3q8)]\n(Background on this error at: https://sqlalche.me/e/14/dbapi)", error_type=<SupersetErrorType.GENERIC_DB_ENGINE_ERROR: 'GENERIC_DB_ENGINE_ERROR'>, level=<ErrorLevel.ERROR: 'error'>, extra={'engine_name': 'Microsoft SQL Server', 'issue_codes': [{'code': 1002, 'message': 'Issue 1002 - The database returned an unexpected error.'}]})] Nov 04 16:21:10 DESKTOP-9QS7RL5 start_superset.sh[43330]: 192.168.110.69 - - [04/Nov/2025:16:21:10 +0800] "POST /api/v1/database/test_connection/ HTTP/1.1" 500 577 "http://192.168.110.204:8088/databaseview/list/?pageIndex=0&sortColumn=changed_on_delta_humanized&sortOrder=desc" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36 Edg/141.0.0.0"
11-05
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值