Comments (2)
I will take a look, thanks!
On Wed, Mar 18, 2015 at 7:27 AM RickEvry [email protected] wrote:
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)
atSystem.Web.Http.Owin.HttpMessageHandlerAdapter.d__13.MoveNext()
install ScriptCs.WebApi2
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.configSuccessfully updated scriptcs_packages.config.
run script
scriptcs test1.cs -modules mono
—
Reply to this email directly or view it on GitHub
#17.
from scriptcs-webapi.
Calling UseJsonOnly before Configure fixes this for me:
var server = webapi.
UseJsonOnly().
Configure(typeof(TestController)).
Start("http://localhost:8080");
In a real situation you will add your own formatters and the problem won't occur.
from scriptcs-webapi.
Related Issues (11)
- Add Web API 2.0 support
- Add OWIN support
- Add helpers for formatters and handlers
- NuGet package out of date HOT 5
- Getting started with Web API using the pack does not work, part 1
- fix CI build HOT 2
- Fix for scriptcs 0.15.0 HOT 2
- Cannot resolve dependency on Owin
- Change type logic to include the script controllers always. HOT 1
- Error <The name 'Require' does not exist> when trying the sample for webapi server HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scriptcs-webapi.