[英]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.