Is there an easy way to get Servicestack to wait x seconds before retrying a failed MQ item (using Redis MQ). At the moment it just tries 3 times consecutively with no delay.
Is there an easy way to get Servicestack to wait x seconds before retrying a failed MQ item (using Redis MQ). At the moment it just tries 3 times consecutively with no delay.
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));
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...
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 = {...
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...
.net,asynchronous,websphere-mq,mq
Your question and code don't match. Is the sender putting messages messages in groups? Because your code is looking for exactly 1 group of messages then it exits the loop. If you want to read all messages (no group) in a loop then you should do something like: MQMessage mqMsg;...
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.
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 { ... }); } ...
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...
You can access the current HttpContext via the singleton: @System.Web.HttpContext.Current.IsDebuggingEnabled ...
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 ...
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...
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...
Couple of problems here. First, you are using the wrong queue. The command server listens on SYSTEM.ADMIN.COMMAND.QUEUE. The queue to which you are sending messages, SYSTEM.ADMIN.COMMAND.EVENT is the queue to which the QMgr puts event messages after executing commands, provided of course that command events are enabled. The second problem,...
I add a remote Queue Manager to my WebSphere MQ client. I'm not at all sure what this means exactly. MQ Explorer keeps a list of queue manager definitions. MQ Client is just a library for making connections. If you meant you added a remote queue manager to MQ...
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}" /> ...
servicestack,ormlite-servicestack
Add a [Flags] attribute to enums you want ServiceStack to treat as integers.
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...
There's a combination of things wrong... Your SERVTYPE(SERVER) is for something which starts running and stays running (and hence whose health is monitored). SERVTYPE(COMMAND) is for something you run and ends. Only a SERVTYPE(SERVER) can be monitored for health but it ought to be long running. Your startcmd needs to...
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://"))...
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...
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...
You need to use SetConfig() when configuring ServiceStack, e.g: SetConfig(new HostConfig { OnlySendSessionCookiesSecurely = true, }); ...
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...
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.
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...
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...
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 {...
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....
.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/" }); ...
Check your error logs (AMQERR01.LOG) for an explanation of why AMQ8135 was returned to the client - for security reasons clients aren't given more information and so you have to go to the logs to get the detail. I suspect the user you're running MQ Explorer and runmqsc as isn't...
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,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)); ...
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,...
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;...
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() }); ...
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...
javascript,authentication,cookies,servicestack,single-page-application
No. HTTP cookies are not exposed to the JS in any way....
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(); } }); ...
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); ...
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" ...
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; }); ...
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(); }); ...
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...
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...
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...
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...
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...
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...
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,...
javax.jms package API says: For historical reasons JMS offers four alternative sets of interfaces for sending and receiving messages: •JMS 1.0 defined two domain-specific APIs, one for point-to-point messaging (queues) and one for pub/sub (topics). Although these remain part of JMS for reasons of backwards compatibility they should be considered...