I've looked this question up, but I don't see too many answers, and obviously none have been helpful or I wouldn't be asking. I am a .NET neophyte.
My local environment is Win7, Microsoft Virtual Web Developer 2010 Express. I added the NewtonSoft.Json as a custom component library.
I built a simple "HelloWorld" web service, using Newtonsoft.Json custom components.
When I do a build on my local machine (Visual Web Developer 2010 Express) it works great. I actually get a valid JSONP output, not XML.
When I FTP my files to the remote web server, my web service does not work. I get this:
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 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 7: using System.Web.Services.Protocols;
Line 8: using System.Web.Script.Services;
Line 9: using Newtonsoft.Json;
Line 10:
Line 11: namespace System.Web.Script.Services.CS
I have tried everything from copying my entire project folder to the remote folder, then deleting everything and just copying my asmx and web.config file, and I still get the error. I copied the bin folder, with the Newtonsoft.Json.dll to the remote server, then tried copying it into the root folder, and to no avail.
Is there some operation that must be performed on the remote server to enable it to use Newtonsoft.Json.dll?
This often occurs because the casing used in the name of the type is not correct. For example, Dataset ds; generates CS0246 because the s in Dataset must be capitalized. If the error is for a type name, did you include the proper using directive, or, alternatively, fully qualify the name of the type?
The Newtonsoft. JSON namespace provides classes that are used to implement the core services of the framework. It provides methods for converting between . NET types and JSON types.
Thanks for the pointer and the link. After a struggle I got it to work. What finally happened was my friend, an expert in .NET Skyped me and talked me through the proper way of deploying my project to the destination server. I didn't understand that there is a separate folder where your Build goes. I made a "Build Deployment Package" as a zip file. Then I unzipped it on my hard drive, and dropped it into a clean folder on the web server (actually, I uploaded it to the root directory), and voila, it worked.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With