servicestack

ServiceStack Routing does not work with querystring

╄→尐↘猪︶ㄣ 提交于 2019-11-28 05:28:21
I have a simple REST service built with ServiceStack. If I configure the routes like this: //register user-defined REST-ful urls Routes .Add<Contact>("/Contacts") .Add<Contact>("/Contacts/{ContactId}") This request succeeds. http://<server>:59557/Contacts?ContactId=9999 //Works If I configure the routes like this (Business Analyst prefers the generated metadata) //register user-defined REST-ful urls Routes .Add<UpdateContact>("/UpdateContact", "PUT") .Add<CreateContact>("/CreateContact", "POST") .Add<GetContact>("/Contacts/{ContactId}", "GET") http://<server>:59557/Contacts/9999 //Works http:/

ServiceStack returns 405 on OPTIONS request

纵饮孤独 提交于 2019-11-28 05:01:42
问题 I'm building a REST webservice using ServiceStack. I want to allow cross-domain request, so I registered the CorsFeature plugin. My AppHost looks as follows: public class HomeAppHost : AppHostHttpListenerBase { public Context Context { get; set; } public HomeAppHost(Context context) : base("HomeAutomation", typeof(HomeInterfaceService).Assembly) { Context = context; } public override void Configure(Funq.Container container) { Plugins.Add(new CorsFeature()); Routes .Add<HomeInterface>("

How to register multiple IDbConnectionFactory instances using Funq in ServiceStack.net

心不动则不痛 提交于 2019-11-28 04:45:19
How would you go about registering diferent IDbConnectionFactory instances in Funq and then access them directly within your services? Do named instances somehow come into play here? Is this the best approach to take when using different databases across services? Thanks! EDIT: An example ;). I could be way off here because I'm pretty new to IoC, but say for example I have 2 separate database connections that I'd like to inject. In ServiceStack, this is done in the Global.asax. container.Register<IDbConnectionFactory>(c => new OrmLiteConnectionFactory(@"Connection String 1",

Need help on servicestack implementation

亡梦爱人 提交于 2019-11-28 04:27:09
问题 I an facing issue with my servicestack implementation, i have make followings requests url to call my service and implemented one perfmon class & perfmonservice class [RestService("/perfmon/application/{appliationId}")] [RestService("/perfmon/application/{appliationId}/{countername}")] [RestService("/perfmon/user/{userId}")] [RestService("/perfmon/user/{userId}/{countername}")] Now when i will call any of the URL it would call following function public override object OnGet(Perfmon request) {

Is it possible to customize the ServiceStack /metadata page?

末鹿安然 提交于 2019-11-28 03:52:38
问题 I run my site behind a loadbalancer on a non-standard port. When loading up the /metadata page it has my public domain name yet the local port that the app is hosted on, which causes the links to the different formats to break as well. Example: in the browser: http://mydomain.com/api/metadata in metadata page: http://mydomain.com:10000/api/metadata Is there a way to customize these links in the output? Further, is it possible to customize the other text/css/etc of the page, such that it can

REST actions and URL API design considerations

。_饼干妹妹 提交于 2019-11-28 03:49:12
I'm building a inventory management system and I'm busy designing (thinking) of the API and my REST implementation. I have the following resources and on the resource you can perform many actions/operations. Each operation will modify the resource and in some cases create a new resource and also create history or transactions. I'm looking for some input from experts in regards to useability and acceptability in regards to URL and resource design. The gotchas and real world examples, any opinion or criticism welcome. My concerns are that the whole application might be develop around this one

ServiceStack: Accessing the HttpRequest in a selfhosted application

 ̄綄美尐妖づ 提交于 2019-11-28 03:36:49
问题 I currently have an IIS hosted application that I would like to switch over to use the self-hosted method. But I'm having difficulty accessing the session so I can retrieve the current users username. This is the code I used when hosting under IIS which worked perfectly: /// <summary> /// A basic wrapper for the service stack session, to allow access to it lower down in the DAL layer without tying us to servicestack. /// </summary> public class ServiceStackAuthTokenService : IAuthTokenService

Sending Data to ServiceStack RESTful service, getting 'Access is denied'

泪湿孤枕 提交于 2019-11-28 01:43:41
I built a RESTful service with ServiceStack which sends data to a database. I've tested it locally and it works great. When I deploy it to a server and run the same code, which is a jQuery $.ajax call, I get an 'Access is denied' error. I have setup CORS in my ServiceStack config using the plugin as explained here . I also set the crossDomain to true in my ajax call. I can't think of what else to do to get this to work, and I'm honestly not sure where this error is being thrown. I've stepped through the Javascript and it doesn't even get to the 'failure' block of the ajax call, the error is

System.BadImageFormatException on running ServiceStack examples.

左心房为你撑大大i 提交于 2019-11-28 00:29:04
问题 I am trying to run ServiceStack Examples projects. When I run the web client I am getting the following error: {System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) at Mono.Data.Sqlite.UnsafeNativeMethods.sqlite3_open_v2(Byte[] utf8Filename, IntPtr& db, Int32 flags, IntPtr vfs) at Mono.Data.Sqlite.SQLite3.Open(String strFilename, SQLiteOpenFlagsEnum flags, Int32 maxPoolSize, Boolean usePool) at Mono.Data.Sqlite

XML deserializing only works with namespace in xml

拜拜、爱过 提交于 2019-11-28 00:24:45
问题 The most simple way I get ServiceStack xml deserialization to work is when the xml contains a namespace. However, the xml I receive do not contain namespaces. The most simple working example: [Serializable] public class test { } class Program { static void Main(string[] args) { string xml="<test xmlns=\"http://schemas.datacontract.org/2004/07/\"></test>"; var result = ServiceStack.Text.XmlSerializer.DeserializeFromString<test>(xml); } } However, that is not what I want. I want the following