简体   繁体   中英

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

I built a website that gets data from an API using RestSharp. I am able to post the data and display it on the website, it works perfect when I run it on 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?)

Source Error:

Line 1: using System;

Line 2: using RestSharp;

Line 3: using RestSharp.Deserializers;

Line 4: using 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.

You hosting doesn't have the RestSharp libraries.

You will need to find a new one that does.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM