简体   繁体   English

RestSharp可在localhost上运行,但在上载到主机时返回错误

[英]RestSharp works on localhost, but returns an error when uploaded to host

I built a website that gets data from an API using RestSharp. 我建立了一个网站,使用RestSharp从API获取数据。 I am able to post the data and display it on the website, it works perfect when I run it on Loaclhost. 我可以将数据发布并显示在网站上,当我在Loaclhost上运行它时,它可以完美地工作。 After completing this website, I uploaded it to my hosting online and when I run the page I get this error: 完成此网站后,我将其上传到在线托管中,当我运行该页面时,出现此错误:

Server Error in '/Application' Application. “ /应用程序”应用程序中的服务器错误

Compilation Error Description: An error occurred during the compilation of a resource required to service this request. 编译错误描述:在编译为满足此请求所需的资源期间发生错误。 Please review the following specific error details and modify your source code appropriately. 请查看以下特定的错误详细信息,并适当地修改您的源代码。

Compiler Error Message: CS0246: The type or namespace name 'RestSharp' could not be found (are you missing a using directive or an assembly reference?) 编译器错误消息: CS0246 找不到类型或名称空间名称'RestSharp'(您是否缺少using指令或程序集引用?)

Source Error: 源错误:

Line 1: using System; 第1行:使用系统;

Line 2: using RestSharp; 第2行:使用RestSharp;

Line 3: using RestSharp.Deserializers; 第3行:使用RestSharp.Deserializers;

Line 4: using RestSharp.Authenticators; 第4行:使用RestSharp.Authenticators;

I have tried different solutions posted online but cannot resolve this issue. 我尝试过在线发布的其他解决方案,但无法解决此问题。

Any help will be greatly appreciated. 任何帮助将不胜感激。

It sounds like you didn't upload the dependent assemblies to your host. 听起来您没有将相关程序集上载到主机。 Doing a “Publish” from Visual Studio will bundle those assemblies for you and should solve your issues. 从Visual Studio执行“发布”将为您捆绑这些程序集,并应解决您的问题。

You hosting doesn't have the RestSharp libraries. 您托管的服务器没有RestSharp库。

You will need to find a new one that does. 您将需要找到一个新的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 网站可以在localhost上运行,但不能在上载到服务器时出现错误 - Website works on localhost but not When uploaded to server it is giving an error RestSharp 返回 BadRequest 错误但 PostMan 工作正常 - RestSharp returns BadRequest error But PostMan works correctly RestSharp Deserialize返回空属性,但xml.deserialize测试有效 - RestSharp Deserialize returns empty properties but xml.deserialize test works 如何清除此Web配置错误,在本地主机上工作正常,但如果我在服务器上上传,则会发生Errror - How To remove This Web config error, It works Fine on local host but if i uploaded on the server then Errror occured PostMan GET 有效,但 RestSharp 返回空 JSON 结果 - PostMan GET works, but RestSharp returns empty JSON result .Replace(Environment.NewLine,“ <br /> “)在localhost上工作,但在我将网站上传到主机时则不行 - .Replace(Environment.NewLine, “<br />”) works on localhost but not when I upload my website to host GridView:在服务器上运行时数据库错误,在本地主机上运行正常 - GridView: Database error when running on server, works fine on localhost 作为依赖项和不同的publicKeyTokens共享时出现RestSharp错误 - RestSharp error when shared as a dependency and different publicKeyTokens API 在使用 RESTSHARP 时返回错误 - API is returning error when using RESTSHARP 嵌套值为null时反序列化的Restsharp错误 - Restsharp error on deserialzation when nested value is null
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM