scriptcs-contrib / scriptcs-webapi Goto Github PK
View Code? Open in Web Editor NEWScript pack for web api
License: Other
Script pack for web api
License: Other
If you follow the instructions on the home page you get an error:
scriptcs -install -pre ScriptCs.WebApi2
Installing packages...
ERROR: Package installation failed: Input string was not in a correct format..
Currently the script pack insists an a Common.Logging.ILog
being injected but in scriptcs 0.15 we do not, and cannot, register that type in the container, since then the container will not be able to pick a constructor for various types which have both a Common.Logging.ILog
overload and a ScriptCs.Contracts.ILogProvider
overload.
After the scriptcs 0.15.0 release, the script pack should be upgraded to the 0.15.0 binaries and insist on a ScriptCs.Contracts.ILogProvider
being injected instead.
The TestController-example on the home page does work. When you call http://localhost:8080/api/test you get an error:
An error has occurred.Type 'System.Dynamic.ExpandoObject' with data contract name 'ArrayOfKeyValueOfstringanyType:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.System.Runtime.Serialization.SerializationException at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType)
at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator writer, Object graph, DataContractResolver dataContractResolver)
at System.Runtime.Serialization.DataContractSerializer.WriteObject(XmlWriter writer, Object graph)
at System.Net.Http.Formatting.XmlMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)
at System.Net.Http.Formatting.XmlMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Owin.HttpMessageHandlerAdapter.<BufferResponseContentAsync>d__13.MoveNext()
scriptcs -install ScriptCs.WebApi2
Installing packages...
Installed: ScriptCs.WebApi2
Package installation succeeded.
Saving packages in scriptcs_packages.config...
Creating scriptcs_packages.config...
Added Microsoft.AspNet.WebApi.Client (v5.2.0, .NET 4.5) to scriptcs_packages.config
Added Microsoft.AspNet.WebApi.Core (v5.2.0, .NET 4.5) to scriptcs_packages.config
Added Microsoft.AspNet.WebApi.Owin (v5.2.0, .NET 4.5) to scriptcs_packages.config
Added Microsoft.AspNet.WebApi.OwinSelfHost (v5.2.0) to scriptcs_packages.config
Added Microsoft.Bcl (v1.1.9, .NET 4.5) to scriptcs_packages.config
Added Microsoft.Bcl.Build (v1.0.14, .NET 4.0) to scriptcs_packages.config
Added Microsoft.Net.Http (v2.2.22, .NET 4.5) to scriptcs_packages.config
Added Microsoft.Owin (v2.0.2, .NET 4.5) to scriptcs_packages.config
Added Microsoft.Owin.Host.HttpListener (v2.0.2, .NET 4.5) to scriptcs_packages.config
Added Microsoft.Owin.Hosting (v2.0.2, .NET 4.5) to scriptcs_packages.config
Added Newtonsoft.Json (v6.0.2, .NET 4.5) to scriptcs_packages.config
Added Owin (v1.0, .NET 4.0) to scriptcs_packages.config
Added ScriptCs.Contracts (v0.10.0, .NET 4.5) to scriptcs_packages.config
Added ScriptCs.WebApi2 (v1.0.0, .NET 4.5) to scriptcs_packages.config
Successfully updated scriptcs_packages.config.
scriptcs test1.cs -modules mono
It's been broken for aaaaaaaaaaaaaages....
And makes our scriptcs root node red
Following the sample, I am running into the following error when running the .csx file for the webapi server:
C:\dev\temp\scriptcs2> scriptcs server.csx
ERROR: Roslyn.Compilers.CompilationErrorException: C:\dev\temp\scriptcs2\server.csx(7,14): error CS7012: The name 'Require' does not exist in the current context (are you missing a reference to assembly 'ScriptCs.Contracts, Version=0.7.0.0, Culture=neutral, PublicKeyToken=null'?)
at Roslyn.Scripting.CommonScriptEngine.CompilationError(DiagnosticBag localDiagnostics, DiagnosticBag diagnostics)
at Roslyn.Scripting.CommonScriptEngine.Compile(String code, String path, DiagnosticBag diagnostics, Session session, Type delegateType, Type returnType, CancellationToken cancellationToken, Boolean isInteractive, Boolean isExecute, CommonCompilation& compilation, Delegate& factory)
at Roslyn.Scripting.CommonScriptEngine.CompileSubmission[T](String code, Session session, String path, Boolean isInteractive)
at ScriptCs.Engine.Roslyn.RoslynScriptEngine.Execute(String code, Session session)
Cheers!
Just a heads up.
The NuGet package on NuGet (https://www.nuget.org/packages/ScriptCs.WebApi/) is version 0.1.0. The code here is at version 0.5.0.
I am getting the following error when using the NuGet package (0.1.0) and executing scriptcs start.csx:
Message: No HTTP resource was found that matches the request URI 'http://localhost:8080/api/Test'.
MessageDetail: No type was found that matches the controller named 'api'.
I don't get this error when using the code here (0.5.0) directly.
> scriptcs -install ScriptCs.WebApi2
Installing packages...
ERROR: Error installing package. [InvalidOperationException] Unable to resolve dependency 'Mi
crosoft.AspNet.WebApi.Owin (? 5.2.0 && < 5.3.0)'.
ERROR: Package installation failed. [AggregateException] One or more errors occurred.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.