Menu
  • HOME
  • TAGS

Send .PDF file generated in memory via Resposne

c#,http,itextsharp,servicestack,httpresponse

From your example code, simply adding the doc.Close() did the trick for me. public byte[] ExportToPdf(DataTable dt) { var mem = new MemoryStream(); var doc = new Document(new Rectangle(100f, 300f)); PdfWriter.GetInstance(doc, mem); doc.Open(); doc.Add(new Paragraph("This is a custom size")); doc.Close(); return mem.ToArray(); } Edit: Like I said on my comment,...

Cookieless authentication using ServiceStack

asp.net,servicestack,basic-authentication,http-basic-authentication

I'm doing something similar, using the ServiceStack v4 API. In my world, the REST API uses HTTP basic credentials over SSL, and only the "password" part (PIN #) is used for authentication. Here's the relevant parts of my Configure(container) method: IAuthProvider authProvider = new BasicAuthProvider(); AuthFeature authFeature = new AuthFeature(...

HttpResult or HttpError with response dto does not get serialized into body

servicestack

After poking a while i have found that the ServiceStack framework works just fine. Even in the older version we are using. The issue exist only when the web.config enables the section. After removing this section all worked well.

ServiceStack ormlite json does not deserialize from database

c#,serialization,servicestack,ormlite-servicestack,servicestack-text

The problem is that your class Inventory has a dictionary keyed by a complex class: public Dictionary<Item, int> Items { get; set; } However, according to the ServiceStack.Text documentation Any IDictionary is serialized into a standard JSON object, i.e: {"A":1,"B":2,"C":3,"D":4} Unfortunately your Item class cannot be represented as a simple...

Can I check for the existence of an HTTP only cookie with Javascript? [duplicate]

javascript,authentication,cookies,servicestack,single-page-application

No. HTTP cookies are not exposed to the JS in any way....

npm's less library - how to define a subdirectory for imports

node.js,npm,servicestack

A mistake on my part, but one which wasn't easily spottable, so I'll post the reason for my problems so that others don't spend hours as I did chasing a solution to an unecessary problem. I was using ServiceStack Bundler - I believe this issue would also have occured on...

ServiceStack's Config.AdminAuthSecret is not working

servicestack

Note: the API to set the configuration in ServiceStack is: SetConfig(new HostConfig { AdminAuthSecret = "9999" }); Config.AdminAuthSecret was used to by-pass Services protected with RequiredRole and RequiredPermission attributes. I've just extended it to by-pass [Authenticate] Services as well in this commit which will be available from v4.0.39+ that's now...

Hide/remove columns from servicestack requestlogger page

servicestack

You can take a copy of the built-in InMemoryRollingRequestLogger and modify it to suit your needs and then register to use it with: Plugins.Add(new RequestLogsFeature { RequestLogger = new MyRequestLogger() }); ...

ServiceStack.Text deserialize string into single object null reference

c#,.net,json,servicestack

By Default ServiceStack only serializes public properties so you could refactor your DTO to include properties, e.g: public class CustomMaker { public int UserID { get; set; } public String error { get; set; } } Or if you wanted to serialize public fields you can specify this with: JsConfig.IncludePublicFields...

How to retrieve Data Annotation Alias(“tablename”) and Alias(“field name”) from ServiceStack ORMLite?

c#,servicestack,data-annotations,ormlite-servicestack

You can query this from OrmLite's ModelDefinition that's created for every POCO Table, e.g: var modelDef = typeof(Account).GetModelMetadata(); var tableName = modelDef.ModelName; var idName = modelDef.PrimaryKey.FieldName; Which in both cases will return the [Alias] if it exists....

Best way to do property level authorization in ServiceStack?

c#,.net,angularjs,entity-framework,servicestack

What ended up being the most pragmatic solution for me was actually pretty simple. The basic idea is that whichever service requires row-level authorization should implement a GetUserRole method, which in my case returns the user's most permissive role. protected string GetUserRole(Domain.Group entity) { var session = SessionAs<AuthUserSession>(); var username...

ServiceStack View 403 (Forbidden)

razor,servicestack,servicestack-razor

See the difference between Views vs Content Pages, i.e. the /Views folder is a special folder for view pages that are only executed with the result of a Service (i.e. similar to ASP.NET MVC Controllers + Views). Essentially Razor pages in /Views can't be called directly, where as razor pages...

How do I apply a custom ServiceStack RequestFilterAttribute to an auto-generated Service?

servicestack

If you wanted to customize the AutoQuery behavior you should first take a look at the extensibility options using Query Filters provides. Otherwise you should be able to add the RequestFilter Attribute to the Request DTO itself, i.e: [MyCustomAttribute] public class MyQuery : QueryBase<Poco> {} Alternatively you can get a...

System.IO.IOException: Too many open files

osx,servicestack,xamarin-studio

I solved a similar issue by disabling Mono's file watcher due to a bug. In the terminal: export MONO_MANAGED_WATCHER=disabled You might also want to look here....

Whats the difference between ServiceStack.OrmLite packages and .Signed version?

c#,servicestack,ormlite-servicestack

ServiceStack NuGet packages with a .Signed Suffix are strong-named, where other ServiceStack packages are not Strong named by default except for ServiceStack.Interfaces which is both Strong-Named and a pure PCL library for maximum accessibility. The ServiceStack download page maintains the list of available Signed packages....

Servicestack reverse routing exception

servicestack

Eventually the problem was with the capitalization of the HTTP method on the route declaration. It worked after I set the route as follows [Route("/user/UserName/{UserName}", "GET")] The service has been working, even when it was declared as "Get" but the "ToAbsoluteUri()" brought up the problem....

ServiceStack Bundler and sub-directory Less files

css,less,servicestack

A mistake on my part, but one which wasn't easily spottable, so I'll post the reason for my problems so that others don't spend hours as I did chasing a solution to an unecessary problem. I was using ServiceStack Bundler - I believe this issue would also have occured on...

How to disable ServiceStack page when accessing from web browser

servicestack

You're not seeing data returned from your Service as your Service is only returning an error. Disable Auto Html Pages You can disable the Auto Html Page by removing the Html Feature in your AppHost Configure(): SetConfig(new HostConfig { EnableFeatures = Feature.All.Remove(Feature.Html), }); In browsers this will typically return XML...

servicestack server events with azure RedisServerEvents doesn't work, while default option MemoryServerEvents works

servicestack,servicestack.redis

oh God.. Finally I found what the issue is.. It had nothing to do with server events code or its confguration!!! But I have the following line used in my application for a different purpose and which had impact on server events! // Set the default reuse scope for the...

In IIS, can I use the same base path for multiple Web API applications?

iis,deployment,asp.net-web-api,servicestack

Reverse Proxying / Url Rewriting to different ServiceStack instances An elegant option is to separate them into distinct Services and conceptually have them appear under the same url structure by using a reverse proxy or rewrite rules in IIS which will let you have different top-level paths mapped to different...

ServiceStack Soap 1.2 HTTPS Client

c#,soap,https,servicestack,soap1.2

The problem with config file is that it isn't always straightforward and sometimes plain unpractical. On top of this ServiceStack promotes config-less coding model. I managed to achieve the required functionality with the following SSL-neutral client: public class SoapServiceClient : Soap12ServiceClient { public SoapServiceClient(string uri) : base(uri) { if (uri.StartsWithIgnoreCase("https://"))...

ServiceStack selfhosting disable caching for memory

model-view-controller,servicestack

Every request does not get cached in memory, when you're self-hosting it's running the binary dlls and static files that are copied into your /bin folder. You can change Config.WebHostPhysicalPath to change ServiceStack to serve files from your solution folder instead, e.g: SetConfig(new HostConfig { #if DEBUG DebugMode = true,...

Annotated Ignore field get's ignored in servicestack reponse

c#,servicestack,ormlite-servicestack

After mythz explained to me the fact that if it doesn't map to your ormlite db it won't map to your resulting DTO later, i build a quick work around. Instead of returning my own response dto immediately in the following line: ARequest : QueryBase<Person, Result>, IJoin<Person, OtherThing> I just...

How to configure NLog (Servicestack) for Multiple files

c#,servicestack,nlog

You should be able to simply use ${threadid} (or if you name your threads, ${threadname}) in the filename layout. This will automatically separate log entries into one file for each thread. <target name="mynewlogfile" xsi:type="File" fileName="${basedir}/logs/mynewlogfile-thread-${threadid}.log" ... layout="${longdate}|${callsite}|mynewlogfile|${message}" /> ...

JsonServiceClient ResponseFilter doesn't trigger

c#,servicestack

The example code you have provided, in isolation, looks correct apart from the client being disposed in the using statement. Once the client is created, an action can be registered on the ResponseFilter as you have shown above. I've created an example project on GitHub in empty ServiceStack ASP.NET solution...

Service Stack Redis in Web Api OData add EdmEntityObject / EdmEntityObjectCollection

dynamic,asp.net-web-api,redis,servicestack,odata

A System.StackOverflowException is indicative that you're trying to serialize non-serializable objects with cyclical dependencies which are not supported in any of ServiceStack's Serializers (and will also fail in most other Serializers). Essentially EF DataModels have cyclical dependencies making them poor candidates for serialization. You should instead have them map to...

Why am I getting 401 responses from my ServiceStack Services when using ServiceStack client

servicestack

The first request fails because it's sending a non-Authenticated request to a protected Service, so the Service is correctly responding with a 401 UnAuthenticated to indicate this. The error response also indicates that the Service supports HTTP Basic Auth with the WWW-Authenticate: basic realm="/auth/basic" response header. When the subsequent request...

ServiceStack minimum configuration to get Redis Pub/Sub working between multiple Web sites/services

servicestack,servicestack.redis

The minimum code for a publisher is just: var redisManager = container.Resolve<IRedisClientsManager>(); using (var mqProducer = new RedisMessageProducer(redisManager)) { mqProducer.Publish(new Msg { ... }); } You could also use a MessageFactory: var msgFactory = new RedisMessageFactory(redisMangager); using (var mqClient = msgFactory.CreateMessageQueueClient()) { mqClient.Publish(new Msg { ... }); } ...

ServiceStack 3.9 build warning

.net,servicestack

You need to ensure all ServiceStack versions are the same. From the instructions on the ServiceStack v3 home page: PM> Install-Package ServiceStack -Version 3.9.71 -DependencyVersion Highest ...

ServiceStack Redis latest list by date

c#,model-view-controller,redis,servicestack

You can do this by maintaining an index of ids in a sorted list, sorted by date. As an example well store a list of articles with different modified dates, e.g: var articles = new[] { new Article { Id = 1, Title = "Article 1", ModifiedDate = new DateTime(2015,...

return data progressively from ServiceStack API

servicestack

This previous answer shows different response types ServiceStack supports, e.g. you can just return a Stream or write to the base.Response.OutputStream directly from within your Service. These ImageServices also shows the different ways you can write a binary response like an Image to the response stream, e.g. here's an example...

servicestack Redis Client AcquireLock TTL has no affect

servicestack,ttl

The Timeout is used within the content of the lock string to calculate an expired lock, i.e. it doesn't change the TTL of the lock key.

ServiceStack cant handle cookie from subdomain angular client

angularjs,cookies,localization,servicestack

By default Cookies in different sub domains are treated as separate domains. You can try specifying the domain on each Cookie with: SetConfig(new HostConfig { RestrictAllCookiesToDomain = "domain.com", }); ...

Swagger url for self hosted servicesteack service

.net,web-services,servicestack,swagger

This issue is now resolved in v4.0.41+ which is now available on MyGet. You can workaround previous versions by specifying the WebHostUrl for your Service, e.g: SetConfig(new HostConfig { WebHostUrl = "http://localhost:1337/api/" }); ...

Retrieve Custom exception message from service layer in ajax call

jquery,asp.net-mvc-5,asp.net-ajax,servicestack

I did following in order to fix my problem : I handled the WebServiceException in my controller method and in catch block I rethrow the exception by filling in required details (mainly my custom exception message from server). Controller method is decorated with "HandleExceptionAttribute" [HandleExceptionAttribute] public JsonResult SearchCustomer(string IndexNo) {...

ServiceStack AutoQuery ordering

order,servicestack

AutoQuery lets you specify multiple Order By's where you can sort in reverse order by prepending a - before the field name, e.g: ?orderBy=X,-Y ...

Convert SQL to ServiceStack.ORMLite Sql Server

c#,sql-server,tsql,servicestack,ormlite-servicestack

For custom SQL like this, you'd use OrmLite's Custom SQL API's, with something like: var results = db.Select<Poco>(@"select convert(date, t.TransactionDate) [Date], tm.TeamName, a.AccountName, count(distinct(t.RequisitionNumber)) Total from task.tblTransactions t inner join task.tblRequisitions r on r.RequisitionNumber = t.RequisitionNumber inner join task.tblAccounts a on a.AccountNumber = r.AccountNumber inner join Team tm on tm.DivisionId...

ServiceStack V4 Basic Auth with wrong credentials + CORS

c#,.net,servicestack,cors

I was able to workaround on this issue using following configuration in AppHost: UncaughtExceptionHandlers.Add((req, res, name, exception) => { //this is needed for inclusion of CORS headers in http error responses //(for example when invalid user credentials passed) res.ApplyGlobalResponseHeaders(); }); ...

ServiceStack Logical Separation of Procedures

web-services,rest,servicestack

The wiki docs on Modularizing ServiceStack shows how you can configure your Service implementation to spread across multiple dependencies, e.g: public class AppHost : AppHostBase { //Tell which assemblies to scan for services public AppHost() : base("My Product Services", typeof(ServicesFromProductA).Assembly, typeof(ServicesFromProductB).Assembly /*, etc */) {} public override void Configure(Container container)...

Soap Address Location : ServiceStack SOAP 1.2

soap,wsdl,servicestack

You can modify the dynamically generated WSDL in ServiceStack by overriding AppHost.GenerateWsdl(), e.g: public override string GenerateWsdl(WsdlTemplateBase wsdlTemplate) { var wsdl = base.GenerateWsdl(wsdlTemplate); return wsdl.Replace( "<soap:address location=\"http:", "<soap:address location=\"https:"); } Add ServiceStack Reference Also as an alternative to SOAP you can use Add ServiceStack Reference which like SOAP allows generation...

ServiceStack Cannot Set Session with Redis

servicestack,servicestack.redis

It appears that I had installed an older version of Redis 2.4.6, and that service was still running. By uninstalling it, and installing Redis 2.8.19, the issue was resolved.

Post-registration action in ServiceStack

.net,authentication,servicestack,ormlite-servicestack

Customizing Authenticate Service Response I would recommend that you always return a concrete class in ServiceStack Services (i.e. instead of an anonymous object) this helps with being able to generate metadata services for the DTO types and lets you deserialize the response in typed APIs. You should also consider adhering...

Dynamically creating operations and services in ServiceStack

c#,api,command,servicestack,cqrs

Single Service that delegates to multiple internal Services I'd first consider whether using a single Service implementation that uses a liberal wildcard route to accept multiple request types which then delegates to different Service implementations based on some param, e.g: [Route("/services/{Type}/{PathInfo*})] public class DynamicService { public string Type { get;...

ServiceStack response filter “short circuiting” causing problems

servicestack

You can override the AppHost.OnEndRequest() which gets called at the end of each request.

ServiceStack's fluent validation does not work with the Equals function

servicestack

The FluentValidation API for Equals is Equal, i.e: RuleFor(request => request.Id) .Equal(0) .WithMessage("'Id' must be equal to '0'.")); Calling Equals just calls Object.Equals() which doesn't register a validator....

Service Stack set HttpCookie.Secure Flag / Attribute?

servicestack

You need to use SetConfig() when configuring ServiceStack, e.g: SetConfig(new HostConfig { OnlySendSessionCookiesSecurely = true, }); ...

ServiceStack Self Hosting Redirect any 404 for SPA (Url Rewrite)

angularjs,servicestack

You can register a Fallback Route with a wildcard for this which will let you handle unknown server routes in your Service in order to return the default page so routing can be handled in the client app, e.g: [FallbackRoute("/{PathInfo*}")] public class FallbackForClientRoutes { public string PathInfo { get; set;...

ServiceStack versioning - how to customize the request deserialization based on versioning

servicestack

The recommended approach for versioning is to take advantage for the natural forwards compatibility of message-based services and extend existing services defensively so it can support multiple client versions and avoid create multiple versions of the same service. If you still want to expose /api/v1 routes than I'd recommend doing...

Retrieve selection of servicestack redis session objects based on values of properties

redis,servicestack,stackexchange.redis,servicestack.redis,servicestack-auth

Instead of SearchKeys you want to be using the newer Redis Scan API's which let you iterate over keys in a cursor. Redis values are blobbed and not indexed so there's not much opportunity to optimize this. The most efficient way would be to inspect the values using a custom...

OrmLite: SQLiteExceptionSQL logic error or missing database near “)”: syntax error

c#,sqlite,servicestack,ormlite-servicestack

This issue is because you Foo doesn't have any columns to INSERT since Id is a autoincrementing primary key and Bar is a [Reference] property so no columns are saved so the INSERT SQL ends up looking like: INSERT INTO "Foo" () VALUES (); This would work if you Foo...

Sql Server query works in management studio but not in C# (ServiceStack.OrmLite)

sql-server,recursion,servicestack

You should use OrmLite's Custom SQL API's when executing Custom Queries, e.g: var result = Db.SqlList<Category>(sql); ...

Servicestack Ormlite seems to be ignoring my Database Schemas c#

c#,sql,servicestack,ormlite-servicestack

This issue is resolved from the v4.0.39+ release of ServiceStack that's now available on MyGet.

How could I add a delay in processing failed messages in ServiceStack Redis MQ

servicestack,mq,servicestack.redis,redismqserver

When you register a MQ handler you can also register an error handler which gets called after publishing a failed message which you can use to add a custom delay, e.g: mqServer.RegisterHandler<MyRequest>( ServiceController.ExecuteMessage, (msgHandler, msg, ex) => Thread.Sleep(1000)); ...

ServiceStack MemoryCached Authentication Register User

c#,servicestack

You'll need to enable the Registration Services to expose Services that allows creating a User with Password, e.g: Plugins.Add(new AuthFeature(() => new CustomUserSession(), new IAuthProvider[] { new CredentialsAuthProvider(), ... }) { IncludeRegistrationService = true }); The IncludeRegistrationService=true option enables ServiceStack's built-in RegisterService which allows creating new users at /register. You...

Removing swagger from ServiceStack WSDL

c#,wsdl,servicestack

You should be able to exclude Services from SOAP by annotating the Request DTO's with the [Exclude(Feature.Soap)] attribute. Because their built-in Services you can use the runtime attribute dynamic API, e.g: typeof (ResourceRequest) .AddAttributes(new ExcludeAttribute(Feature.Soap)); ...

ServiceStack.OrmLite SqlServer new Merge method doesn't work for different names of references

c#,sql-server,servicestack,ormlite-servicestack

This should now be resolved with this commit which is available from v4.0.41+ that's now available on MyGet.

Return simple raw string in ServiceStack (.NET)

servicestack

The [Route] attribute should be on the Request DTO, i.e: [Route("/monitor/check")] public class EmptyRequest : IReturn<string> {} public class InternalService : Service { public object Get(EmptyRequest request) { return "GoodToGo"; } } ...

ServiceStack: VS 2012 Add service reference

c#,soap,servicestack

You should ensure that only a single WSDL Namespace is used for all DTO's. As ServiceStack built-in DTO's are already defined with the http://schemas.servicestack.net/types it's easiest and recommend to just stick with that which you can do by adding an assembly [ContractNamespace] attribute in your Assembly.cs, e.g: [assembly: ContractNamespace("http://schemas.servicestack.net/types", ClrNamespace...

ServiceStack intercept requests before they are sent client side

servicestack

I found a solution for this. Instead of using LocalHttpWebRequestFilter, need to just use RequestFilter. The final solution looks like this: var client = new JsonServiceClient(); client.RequestFilter += delegate(HttpWebRequest request) { // ContentType still null at this point so we must hard code it // Set these fields before trying...

How do I enable HTTP Compression when using servicestack with IIS8

compression,servicestack

If you just want to add a header you can always add a GZip ContentEncoding Response Header with a Response Filter, e.g: GlobalRequestFilters.Add((req, res, dto) => res.AddHeader(HttpHeaders.ContentEncoding, CompressionTypes.GZip)); But ServiceStack only compresses cached responses itself i.e. when using ToOptimizedResult() API's or returning a responses in a CompressedResult, e.g: public object...

How to make ServiceStak service internal access only

.net,servicestack

The easiest way to restrict all Services is to use a GlobalRequestFilter, e.g: GlobalRequestFilters.Add((req, res, dto) => { if ((RequestAttributes.InternalNetworkAccess & req.RequestAttributes) == 0) { res.StatusCode = (int)HttpStatusCode.Forbidden; res.StatusDescription = "External Requests are Forbidden"; res.EndRequest(); } }); ...

Passing parameters to HTML (view) outside of DTO

servicestack,servicestack-razor

The Request.Items Dictionary is what you can use to pass additional data throughout ServiceStack's Request and Response pipeline. But you don't need to pass all the data the views need as you can retrieve any additional data you need inside the View itself, e.g. The Email Contacts example shows different...

ServiceStack authentication with both [Authenticate] and [ValidateApiKey] attributes

authentication,servicestack,api-key

Attributes can only be combined to add functionality, i.e. they can't be used as a fallback or a switch. To get the desired behavior your [ValidateApiKey] attribute should perform the validation fallback as part of its implementation, e.g: public class ValidateApiKeyAttribute : RequestFilterAttribute { public override void Execute(IRequest req, IResponse...

Updating Xamarin app with servicestack

xamarin,servicestack

The official API has never changed and only has ever been IosPclExportClient: IosPclExportClient.Configure(); The class is defined in the ServiceStack.Pcl.iOS.dll and should be added by NuGet when you add the ServiceStack.Text NuGet package. If it's not you can try removing and re-adding the NuGet package again, otherwise you can adding...

How to globally change the command timeout using ServiceStack.OrmLite

servicestack,ormlite-servicestack

You can change the CommandTimeout globally with: OrmLiteConfig.CommandTimeout = NewTimeoutInSeconds; Scoped Timeout You can also specify a Timeout for a particular db connection with: using (var db = dbFactory.OpenDbConnection()) { db.SetCommandTimeout(NewTimeoutInSeconds); } ...

ServiceStack Funq Container setting public Members to null

c#,servicestack,inversion-of-control,funq

The AutoWiring in ServiceStack's IOC uses a pre-compiled expression to populate all public instance properties. At the time the static factory is created it doesn't know all the registered dependencies that exist yet so the factory that's created, autowires each public writable property. When you want different behavior you can...

ServiceStack Is IsDebuggingEnabled in View (HttpContext missing)

asp.net-mvc,servicestack

You can access the current HttpContext via the singleton: @System.Web.HttpContext.Current.IsDebuggingEnabled ...

How to prevent the logging of a failed request to favorite.ico with ServiceStack

servicestack

The Logging is in the NotFoundHttpHandler itself so to avoid logging you'd return a custom HttpHandler that doesn't log, e.g: appHost.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) => { if (pathInfo.StartsWith("/favicon")) return new CustomActionHandler((req,res) => { res.StatusCode = 404; res.StatusDescription = "Favicon not found"; res.EndRequest(); }); return null; }); ...

Servicestack Services with dynamic data

servicestack

Code-first Services Framework ServiceStack is predominantly a code-first Services framework with many of its features centered around your code-first POCO's. Without a well-defined POCO to define your Service there's no source definition for ServiceStack's metadata services to refer to, or concrete type to deserialize into, etc. Returning Custom JSON or...

Servicestack Embedding Javascript Resources

razor,servicestack,mef

The section on Embedded Resources in Virtual File System wiki explains the Embedded Resources support in more detail where you just need to ensure the Assembly that contains your embedded resources is defined in either the Config.EmbeddedResourceSources Assembly list or Config.EmbeddedResourceBaseTypes types list, e.g: SetConfig(new HostConfig { EmbeddedResourceSources = {...

What happened to SafeConvertAll in ServiceStack?

servicestack

It's just a safe wrapper around ConvertAll to treat null collections as empty collections, it's been replaced with a much shorter Map() alias, e.g: public object Get(Images request) { return Directory.GetFiles(UploadsDir) .Map(x => x.SplitOnLast(Path.DirectorySeparatorChar).Last()); } You can also use .Safe() to return an empty collection for null collections letting you...

ServiceStack CredentialsAuthProvider is ignore rememberMe = false

servicestack

Both of ServiceStack ss-id and ss-pid Session Cookies are always created. The ?RememberMe=true parameter indicates that the Users Session should be stored under the permanent Id ss-pid instead of the default Temporary Session Id ss-id which is how Users Sessions can survive Browser restarts since the ss-pid permanent Cookie isn't...

ServiceStack Authenticates both iOS Apps when one is logged in

rest,xamarin,servicestack,restful-authentication,servicestack-auth

The issue is because you're using the same Session Cookies with a shared ServiceClient instance which ends up referencing the same Authenticated Users Session. ServiceStack Sessions are only based on the session identifiers (ss-id/ss-pid) specified by the clients cookies, if you use the same cookies you will be referencing the...

Potential illegal fragment detected when using OrmLite SqlExpression with Mysql?

mysql,servicestack,ormlite-servicestack

You should normally use the Custom Sql API's like db.SqlList<T> when executing Custom SQL. If you want to use Custom SQL in a typed SqlExpression you should use the Unsafe* API's to by-pass any Custom SQL detection. But for the Select API of an SqlExpression you should only be adding...

Anonymous object blob in database not serializing as JSON when queried

json,servicestack,ormlite-servicestack

Found this link that solved my problem: https://github.com/ServiceStackV3/mythz_blog/blob/master/pages/314.md Essentially I added a "Type" field to the ItemStep class, and set that when I create a new row (create the next step in the timeline). Then, when I retrieve that record, I call a method like "GetBody" in the referenced link...

ServiceStack ORMLite - Can't Infer Relationship (because of DTO name?)

servicestack,ormlite-servicestack

I've just tried creating an AutoQuery Service with all the types you've provided under a custom MyNamespace and it's working as expected (in the latest of ServiceStack), i.e: Service definition: namespace MyNamespace { [Route("/visits/{VisitId}/services", Verbs = "GET")] public class ServicesAtVisit : QueryBase<VisitService, ServiceAtVisit>, IJoin<VisitService, Service> { public int VisitId {...

Servicestack Authentication namespace using SOAP

.net,api,soap,servicestack

You set your custom ns at the wsdl level, but the type itself is still using its own ns which I assume is the default one "http://schemas.servicestack.net/types". Not sure how you could change those built-in ns, not even sure if that's possible, but you might create your own auth provider...

Are ServiceStack's validators instantiated with every new request or is it a Singleton?

servicestack

A validator is resolved and executed from the IOC like any other dependency. The default scope when registering an IValidator is ReuseScope.None which results in a new instance being resolved each time.

Redirect Legacy Post to ServiceStack API

asp.net,asp.net-mvc,servicestack

Answer and discussion within comments. Adding answer to make it easier for others to find solution. The Temporary rewrite rule (within the question) is correct and will do a 307 POST maintaining the original values. The issue was an already existing Redirect rewrite rule was creating a 301 prior to...

Ormlite int based enums coming as varchar(max)

servicestack,ormlite-servicestack

Add a [Flags] attribute to enums you want ServiceStack to treat as integers.

How to upgrade nuget packages if the installed version is missing?

servicestack,nuget

The best solution I've come up with for this is to manually edit the Packages.config file(s) and set the version number to whatever you want. Restore should then work. It's not a perfect solution but it has dug me out of some holes.

Thread safety of Service Stack Redis connections

c#,asp.net,redis,thread-safety,servicestack

You should not share RedisClient instances across multiple threads as they're not ThreadSafe. Instead, you should resolve and release them from the thread-safe Redis Client Managers - also mentioned in the docs.

How to use InsertOnly method in OrmLite?

servicestack,ormlite,ormlite-servicestack

You can find some examples in ApiSqlServerTests, e.g: db.InsertOnly(new Poco { FirstName = "Amy", Age = 27 }, q => q.Insert(p => new { p.FirstName, p.Age })); and async versions in ApiSqlServerTestsAsync, e.g: await db.InsertOnlyAsync(new Poco { FirstName = "Amy", Age = 27 }, q => q.Insert(p => new {...

Serialising XML from database with ServiceStack

c#,xml,json,serialization,servicestack

XML Serializers are particularly hard to deserialize into POCO's it doesn't know about and may require extra hints on the destination model attributed with either [DataContract] or XmlSerializer Attributes depending on which .NET XML serializer you choose. ServiceStack has wrappers around both of these serializers which implement the IStringSerializable interface:...

Xamarin.Forms: Call to a API using ServiceStack throws exception

c#,xamarin,servicestack,xamarin.forms

I have found out how to avoid the exception. I've put the code in the Droid project and used a DependencyService to call the method from my PCL project. My problem was for Android. If you get the problem for IOS, the other answer may help you.

ServiceStack not rendering Razor View, only seeing Snap Shot

twitter-bootstrap,razor,twitter-bootstrap-3,servicestack,servicestack-razor

Looks like this problem might be coming from an existing MVC Razor item template that is adding NuGet package Microsoft.AspNet.Razor.3.2.2 which is overriding the ServiceStack.Razor reference. One way to avoid this is to use the basic HTML item template when adding a new view and name it with the cshtml...

How to properly register Redis Master and Slaves with ServiceStack Client Managers?

redis,servicestack,servicestack.redis

The RedisSentinel support in ServiceStack.Redis is available in the RedisSentinel class but as it's still being tested, it's not yet announced. You can find some info on how to use and configure a RedisSentinel in this previous StackOverflow Answer. Configuring a RedisSentinel When using a Redis Sentinel, it's the redis...

How to handle JSV with a comma(,) containing value?

servicestack,servicestack-text

JSV uses CSV-style escaping where any string that requires escaping should be wrapped with double-quotes, e.g: Address:"#39 ,street ,Country" ...

LINQ query fails with nullable variable ormlite

linq,servicestack,ormlite-servicestack

This is nature of the Linq. In order to achieve what you need, you will need to use two where closes: dbConn.Where<Product>(p => p.IsActive.HasValue).Where(p=>p.Value==true); ...

Do the Request filters get run from BasicAppHost?

servicestack

No the Request and Response filters only fire for Integration Tests where the HTTP Request is executed through the HTTP Request Pipeline. If you need to test the full request pipeline you'd need to use a Self-Hosting Integration test. Calling a method on a Service just does that, i.e. it's...

How to use ServiceStack with Razor on mono

ubuntu,mono,servicestack

Compiling Razor Views and the RazorGeneratorBuildTask doesn't work on Mono. The Razor Views need to be compiled on Windows/.NET first you should then be able to run the compiled Razor Pages dll in Mono.