Can s#arp-architecture/mySQL run under medium trust? Alternatives? - asp.net

I am trying to get a simple prototype using ASP.NET S#arp-architecture (Sharp architecture) to run on a shared hosting site. This site runs in medium trust, which appears to give problems with this framework. At first I went off on a wild goose chase with the mySQL.data.dll, but the latest version already supports partially trusted callers.
The only way I found up until now is this blogpost, which basically describes re-compiling everything from the ground up, starting with the various Castle components. Is this the only way to get this to work, and more importantly, does this actually work?
I have had some good experiences with S#arp-architecture, and since I only have a few days to build this prototype, I figured S#arp-architecture would be a good match. So, my options are to stick with SA, or on the other end of the spectrum to hand-roll an MVC/NH/mySQL application. Other suggestions (using NHibernate and ASP.NET MVC) are also welcome.

Two-fold answer: re-compiling everything does work. I got a simple S#arp-architecture app to work at this hosting provider. I did not want to risk going over my prototype deadline however, so for the demo I built a very straightforward, simple app with (gasp!) straight ADO.NET.

Related

Selected tech. stack for web application - criticism / comments?

I'm about to build my first serious Lisp-based project: a web application that will need to scale to tens of thousands of users (not concurrently - probably hundreds, at most, concurrently).
The stack I'm intending to use looks like:
Weblocks web framework with a BerkeleyDB back-end
Elephant object database
Steel Bank Common Lisp (SBCL)
Ubuntu Server (10.04 LTS)
I have two areas of concern re. this stack:
Is Elephant dead? The latest release is getting on for three years old ... which could just mean that it's stable I guess :-)
As a relative newcomer to Lisp (but with significant RoR & ASP.NET experience) are any of those technologies likely to melt my head?
Feedback on my choices, & suggestions of alternatives, would be appreciated.
Elephant is effectively unmaintained. It does not work on current SBCL and the patch to fix the issue has not been applied. It's possible that someone else might pick up the development but it's not clear in the short term if that will happen. Some people use Rucksack as an object store, and bknr-datastore is also interesting.
Ubuntu is fine, but don't use Ubuntu Lisp packages; it's better to get SBCL from www.sbcl.org and libraries via Quicklisp. Because of that, almost any Linux will work equally well. I use Debian for my Lisp-powered website.
Weblocks is a continuations-based web framework - it is a very old approach, it should not be used for developing modern web-applications.
If you don't mind using PostgreSQL for persistence, you should check out Postmodern.
I have tried Weblocks, and i have made a simple web app also. But when i want to write a more complicated app, i found Weblocks is too limited. It lead user to write more widgets, but i suppose widgets cannot solve all web UI problem. I even read 80% source codes of Weblocks. But .... finally i decided to change another Web framework. What i really need, i suppose, is a url routing library like Ruby on Rails, Restas is fine. I tried it, and i wrote a blog library which support themes like WordPress using Restas. Restas is easier than Weblocks, but more powerful in my opinion.

What are some things Mono is not a good fit for?

I've started your typical web project from scratch using the Mono platform. You know, web services, a UI, MySQL database, all that. I've heard around the net that it's not a picture-perfect implementation of the .Net platform, but so far I can't find anything it's not good at. I see the odd "Not Implemented" pop up in intellesense, but haven't run into any snags or dead ends.
Have you hit a brick wall with a .Net feature that's not implemented in Mono?
From my understanding, the guys working on Mono have pretty much feature completed their version of ASP.NET 2.0. Now I know they have been working on getting the .NET 3.5 things like LINQ and such implimented, but I'm not too sure how far they've gotten with that. I do know that working the desktop has been a little more difficult and they've been working to get a few of the desktop specific namespaces worked out like System.Windows.Forms.
Here is an article that dives a little bit deeper into the whole Mono setup. It's a little old, but has a lot of code and descriptions to digest.
Good luck, and hope Mono works out for your project.
License is a problem, noncompacting GC is another problem, there is no WPF, WF, Entity Framework, has only basic WCF, MonoDevelop has a long way to race with Eclipse/VS.Net, mod_mono isn't stable or perfect as tomcat/IIS, I couldn't find any high traffic site using it...but, You probably will not face with a serious problem, if your project isn't enterprise level. C# is probably the best architected language ever and evolving fast. .Net framework is far better than jdk in my opinion and mono people working hard, but there are other problems as I said; another choice is Java. Java has the mature / rack-solid state of art projects like Terracotta, Hibernate (ported to .net), Ehcache, Compass,... but some people say that Sun is out of money and Java isn't evolving for years (as a language) so began to die,...
I think the most important thing is finishing the job done right and on time. Select the technology which you know best and like most and don't waste your time by looking back. It'll be not a problem until your project grows too much.
Cheers,

Leading the jump from Classic ASP to ASP.NET, any advice?

I just started at a new company that has 99% of their code written in classic ASP (most of it poorly written) and part of the reason they hired me was because I had worked with both ASP and ASP.NET in the past. The ASP.NET experience was VB.NET but I've worked with C# in college but I prefer it just because I've worked a lot with PHP in the past and when I'm not focusing I just start typing C syntax and have had many occasions here in ASP where I end lines in a semi colon just out of habit and have to go back and delete it.
But I digress, basically I just don't have the knowledge I need to make the best decisions on things have made notes of some key processes that I'd like advice on:
Version Control - truth be told I've never really used it. On my own I just never had that whoops moment to push me to use it and shops I've worked in have always just thrown caution to the wind. Would like to know what you all think I should use as far as the server side and
Local Dev Environment - Probably something I'll just quickly Google but I want to setup a local dev environment so I can test stuff without having to FTP it somewhere first.
Pushing Changes Live - I've never really understood the step between checking something into version control and seeing it live, is there some sort of automated system that can go "hey I see you checked in, let me see what's different between this and the live version and push the affected files" – possibly just a lack of vc understanding all together: (
IDE - Downloading VS2010 Beta 10 now, hoping it's stable
MVC.NET - Easy to pickup? I always hated the whole concept of Web Forms, seemed like it didn't ultimately fit the Internet the rest of the world is developing.
Anything Else - Like I said I'm relatively new to this stack so I'd love any advice I can get early on to avoid any "shit, I wish I knew that 3 months ago" moments.
Version Control:
Definately have a look at SubVersion, its free, we use a paid-for hosted service called Assembla (www.assembla.com) but you can install the server on your network. Themost popular client is called TortoiseSVN (http://tortoisesvn.tigris.org/) its also free.
You can also have a look at VisualSVN (http://www.visualsvn.com/) which integrated into the VS IDE, their site also has a handy SVN server installation.
Local Dev Environment
Local IIS or Built-in VS web-server in VS are both fine, it really down to preference I think. Opening a website (File-system based) rather than IIS based seems to work quite well for us.
Pushing Changes Live
ASP is very page by page based development and doesnt require compiling, copying files up to a test or production site is quite easy. Depending on how you compile/publish your asp.net site, you will need to consider how you compile library code and publish your web application/website.
I would recommend starting off by using SVN to commit changes and to update test/production sites.
IDE:
I would recommend updating to the latest Beta version of VS2010 and use that.
Anything else:
Consider the rollout, are you replacing everything before going live?
Consider adopting an existing framework, use an ORM, or Business Objects framework, possibly even use Code-Generation. Have a look at CodeSmith, it has various ORM/Business Object Frameworks associated with it. (these will use various teqniques and technologies in the .net framework, which you will need to learn)
Look at the basic structure of the site:
Consider asp.net WebForms (Applications) or MVC (Websites) [yes, this is a very basic analysis of the differences]
Site Membership and Permissions: Have a look at the MembershipProvider, RoleProvider and build your own.
File System: Consider how and where you will upload files.
Separate UI into re-usable UserControls.
HTH, Good Luck you have a lot to do...
Wow. lots of questions here:
Version Control - Look into Subversion and Git. They represent two kinds of version control, you might like one more than the other. Git is free for open source projects.
Local Dev Environment - I would recommend using the built-in web server in Visual Studio. You can right-click a page in your solution explorer and say "view in browser". Then it will just compile it right there and open up an instance of the local web server.
Pushing Changes Live - I am not gonna offer advice here. Someone smarter than me will surely do so.
IDE - Yeah, just stick with the current version of Visual Studio. If you don't have any active (for pay) projects, I think the VS2010 is a good idea because it supports the newest upcoming features of asp.net and by the time you learn them, it will probably be released to the public anyways.
Anything Else - It's worthwhile (from getting work perspective) to know WebForms in and out. But I would highly suggest learning ASp.Net MVC (if, for no other reason than, "it's more fun").
After reading Mark Redman's answer, it triggered something for me. I would recommend (as he does) that you investigate some sort of ORM. I use SubSonic and really love it. Bu t there are lots of options out there.
Those are my 2 cents.
I'm going to focus on versioning and project tracking here. Development environments for ASP.Net are well documented.
Version Control - I use SVN (version control) with Tortoise SVN (windows client integration) and Trac (project tracking). SVN and Trac both run on Apache (a web server).
Pushing Changes Live - Commit your changes to SVN from your dev machine, do a SVN update on your test site to pull down the latest changes from the repository, run tests, then do a SVN update on your production site.
Anything Else - In this scheme Apache, Subversion, and Trac will be running on a server that is NOT your development machine and hopefully (but not necessarily) also not the same server that is running your production IIS.
Check out:
Apache HTTP server: http://httpd.apache.org/
Subversion: http://subversion.apache.org/
Tortoise SVN: http://tortoisesvn.tigris.org/
Trac: http://trac.edgewall.org/
One thing to take account of is basically going from Classical ASP to ASP.NET is about as similar as going from COBOL to ASP.NET. Everything will basically need to be a complete rewrite (especially as you said there were poor development practices in the original codebase)
Version Control: Definitely use it, there's also Team Foundation Server which if you can convince the company in the value of purchasing you a MSDN subscription TFS is included at no additional cost for 5 or less users.
Pushing changes live: I currently use Web Deployment projects (not sure if they're compatible with VS2010), TFS is also a build server I just haven't had time to setup the responsibility for that. If you take advantage of TFS fully I'd also recommend looking into a continuous integration (CI) tool something along the lines of Jetbrains's TeamCity or CruiseControl etc.
Local Dev Enviroment: Get Jetbrains's Resharper! This is the number one most important tool to developing software in .NET second only to Visual Studio itself!
Anything else: Learn generics and lambdas/expression trees both are integral to proper software development in .NET and both are moderately to extremely complex topics (IMO).
Version control: I see many recomendations of SVN here but... it's just outdated. Use GIT or Mercurial. They merge algorithms are more robust. The are faster and safere because they are distributed. They are more flexible - you can construct a workflow model that suits your company well while there is basically one way of using SVN.
Pushing changes live: After you have version control, the next thing to do is making a Continous Integration server thah repeatedly checks out repository and perform automated build. You can get immediate information who and where made an error. You can make this build do anytking you want: perform static code analysis, unit tests, deployment. You can make several builds - one, automatic, that builds a project and deploys it to a testing environment. And another one, triggered manually, that will deploy to live. I worked with Hudson, Jenkins, CruiseControl.NET, TeamCity and I've found TeamCity to be the most user friendly tool of that four.
Local dev env: Althoug IIS Express (that Visual Studio built-in) is OK in many cases, you have to know where it differs from the 'real' one. I would just recommend using the full IIS 7.
IDE: Visual Studio + Resharper + Notepad++ + LINQPad.
Anything else: Have some bug tracking/planning software. Even as simple as http://www.trello.com, but use it. My favourite is http://www.pivotaltracker.com
Introduce code review into the workflow. http://www.reviewboard.org might help.

When should new .NET projects be designed for .NET 4 Framework

I am preparing to start on a new short-term contract (1-2 months) that involves replacing an Access application by moving it to ASP.NET and SQL Server.
I am only responsible for the ASP part and connecting it to the database.
The only requirement is that whatever technologies I use be relatively well-known in the area, so that if they need to have someone else work on it, it isn't specialized knowledge.
So, I could do this in Rails or ASP.NET, but, when should the development be aiming for .NET 4 Framework, as there are many changes coming out that may be advantageous to use.
Or, even though it may be useful, when is it better to just ignore new features and stay on an older version of .NET?
I am assuming that hardware isn't the limitation, as many computers won't be able to run .NET 4 Framework, but that would be an issue for a hosting company, as they can find a hosting company to support whichever framework the application is designed for. If Rails makes the most sense, as their hope is to have the application written quickly, but have it reliable, then again, the hosting company would need to support it, or they use a different one.
This company hasn't used a hosting company, they need to find one, so there isn't a relationship that could be an issue.
UPDATE: Part of my concern is that initially the application will not require javascript, but phase 2 will be to make it more interactive, as some clients won't be allowed to have javascript on their computers. In order to limit how much javascript must be known by a developer there are frameworks that will adapt to browsers and situations fairly well, which is why I am also thinking about RoR and the fact that there appears to be changes coming out in .NET 4 that may help with this.
As a general rule of thumb, I wait one year before building sites in a new framework unless the client specifically asks for the newest technology. This has worked out very well for me. The advantages are:
The technology is much more stable (hotfixes, service packs, etc.)
Common complaints about missing functionality are usually resolved
Hosting companies, support communities and corporate IT departments have had time to get used to the technology, find out more about it, play around with it and have it mature within their organization
Unless there is specific need for new functionality introduced by .Net 4, there is no point in subjecting your clients to the immediate problems with an initial release, or making it more difficult for them to find hosting. You should either investigate all of this up-front, or use .Net 3.5 in the meantime.
The only requirement is that whatever
technologies I use that it be
relatively well-known in the area, so
that if they need to have someone else
work on it, it isn't specialized
knowledge.
I would have thought that requirement was enough not to develop this project on .NET 4.0 - it takes time for a new framework version to filter down into the market, and it will be a while yet before there are a lot of developers around with .NET 4.0 experience.
Also, you would be essentially developing on top of a BETA product - while I'm sure most of the features will remain unbroken from BETA -> RTM, there is always a risk that something will break or not work like it did in BETA, so why risk this on a commercial project?
I wouldn't target .NET 4.0 yet on a commercial project unless there was a specific reason for doing so, and even then you would have to have buy-in from the client, ie "I can do this much more quickly and with less effort if we use the current beta version X rather than established, stable version Y" - good luck with that.
I worked on a commercial project that used the CTP version of LINQ to SQL - then when we went to VS2008 / 3.5, suddenly everything changed and we had to make a lot of changes just to get LINQ to SQL working again.
Stick with 3.5 - it's easier for hosting and getting developers.
Just a couple of thoughts, I wouldn't even think about creating an application for production use in .NET 4/ASP.NET 4 until:
There is a release candidate. It's
not the first time I've seen
features in beta's not make it to
RC/RTM.
Microsoft have permitted development and deployment
of production applications by way of a 'Go
Live' license.
There are some hosters out in the market such as OrcsWeb who are participating in public beta testing, but they aren't intended for production use.
I'd run with the .NET 3.5/ASP.NET 2.0 or MVC bits for now. Better safe than sorry.
Generally speaking it's going to be easier finding hosting for a Rails app. If you want to run .net 4.0 you're probably going to have to run a VPS or dedicated machine. However if you're bailing after the application is finished and assuming your client is in Knoxville, they're going to have a tougher time finding a Rails developer to maintain the application.
I think the bigger question is your role. They're looking to you to solve this problem for them. Are you productive in both technologies? How about getting a Windows server up and running? A Linux server? How's your SQL Server vs MySql? I'd guess that you're probably stronger on one stack vs the other - for a contract that short I wouldn't want to be doing a lot of experimental development.
i wait until the OS that everyone will be using has it.
Just last month i took a dependancy on GDI+, which first shipped with Windows XP.

What are the current best practices for load testing and profiling ASP.NET web applications?

I am tasked with improving the performance of a particular page of the website that has an extremely high response time as reported by google analytics.
Doing a few google searches reveals a product that came with VS2003 called ACT (Application Center Test) that did load testing. This doesn't seem to be distributed any longer
I'd like to be able to get a baseline test of this page before I try to optimize it, so I can see what my changes are doing.
Profiling applications such as dotTrace from Jetbrains may play into it and I have already isolated some operations that are taking a while within the page using trace.
What are the best practices and tools surrounding performance and load testing? I'm mainly looking to be able to see results not how to accomplish them.
Here is an article showing how to profile using VSTS profiler.
If broken it is, fix it you should
Also apart from all the tools why not try enabling the "Health Monitoring" feature of asp.net.
It provides some good information for analysis. It emits out essential information related to process, memory, diskusage, counters etc. HM with VSTS loadtesting gives you a good platform for analysis.
Check out the below link..
How to configure HealthMonitoring?
Also, for reference to some checklist have a look at the following rules/tips from yahoo....
High performance website rules/tips
HttpWatch is also a good tool to for identifying specific performance issues.
HttpWatch - Link
Also have a look at some of the tips here..
10 ASP.NET Performance and Scalability secret
Take a look at the ANTS Profiler from Red Gate. I use a whole slew of the Red Gate products and am very satisfied!
There are a lot of different paths you can go down. Assuming a MS environment you can leverage some of the team system tools such as MS Team Tester to record tests and perform load testing against your site. These can be set to run as part of an automated build process.
A list of tools is located at: http://www.softwareqatest.com/qatweb1.html#LOAD
Now, you might start off simple. In this case install two firefox plugins: Firebug and YSlow for Firebug. These will give stats and point out issues such as page size, the number of requests made to get the page, etc. They will also make recommendations on some things to fix.
Further, you can use unit tests to execute a lot of the code behind to see what functions are hurting you.
You can do all sorts of testing if u have full MS dev system with TFS and Visual Studio Team Edition. Based on what I see here
I recently had a nice .Net bug which was running rampant. This tool sorta helped, but in your case, I could see it working nicely..
http://www.jetbrains.com/profiler/
Most of the time we've used WCAT from Microsoft. If your searches where bring up ACT then this is probably the tool you want to grab if you are looking for requests per second and the such. Mike Volodarsky has a good point pointing the way on how to grab this.
We use it quite a bit internally when it comes to testing our network infrastructure or new web application and it is incredibly flexible once you get going with it. And it seems every demo Microsoft has done for us with new web tech they seem to be busting out WCAT to show off the improvements.
It's command line driven so it's kinda old school, but if you want power and customization it can't be beat. Especially for free.
Now, we use DotTrace also on our own applications when trying to track down performance issues, and the RedGate tools are also nice. I'd definitely recommend a combination of the two of them. They both give you some pretty solid numbers to track down which part of your app is the slowdown and I can't imagine life without DotTrace.
Visual Studio Test Edition (2008 or 2010) comes with a very good load testing component for ASP.NET apps.
It allows you to get statistics for all the perfmon stats for a server (from basics like CPU and disk waits to garbage collection and SQL locks)
Create a load test for the page and run it, storing the stats in a database for the base line. Subsequent runs can be compared.

Resources