Building a First Run Installer in ASP.NET MVC - asp.net-mvc

I'd like to build a web installer into my ASP.NET MVC application. It would be a first run installer that would allow the user to create a user account, set database connection strings, and configure some first run settings. I was looking at SPA's like HotTowel and OAK. Any advice on a good direction to go would be appreciated!

I've not done this myself but I know Orchard CMS http://www.orchardproject.net/ has similar to what you require. Reviewing their code might be a good place to start.

Related

How can I get an ASP.NET MVC site running on Mono?

I've found plenty of questions / blog posts about this, but I have not seen a repeatable recipe for getting an MVC site running on Mono. Nor have I been able to, after many hours of attempts, been able to get an MVC site to run on Mono.
I can spin up whatever version of whatever distribution is required, and can use either MVC3 or MVC4. I would prefer to use nginx, but can use mod_mono as well. I can build from source or use packages.
Can anyone give a step-by-step on getting MVC to run on Mono?
Example Error
This is what I get when I try to run a barebones app on fastcgi or xsp:
Missing method .ctor in assembly
/tmp/root-temp-aspnet-0/eaee30a1/assembly/shadow/bef1c25f
/a2978c47_1c664e18_00000001/System.Web.Providers.dll,
type System.Data.Objects.DataClasses.EdmRelationshipAttribute
Can't find custom attr constructor image:
/tmp/root-temp-aspnet-0/eaee30a1/assembly/shadow/bef1c25f
/a2978c47_1c664e18_00000001/System.Web.Providers.dll mtoken: 0x0a000012
It's very easy. Use MonoDevelop IDE http://monodevelop.com/.
Check this page http://www.integratedwebsystems.com/2011/06/get-mvc3-razor-running-on-mono/

Using the razor engine in SharePoint 2013 Visual Web Part

I'm trying to make use of the razor engine in a SharePoint 2013 Web Part. This, I read, shouldn't be too difficult since SharePoint 2013 Visual Web Parts can be built using .NET Framework 4.0
I'm simply not sure of where to begin to do this. I've seen an article on uploading the .cshtml file onto a document library and referencing the document library in the Web Part, but it is a bit unclear.
Does anyone have an idea of how I can start? Or point me to a step-by-step guide to achieve what I am after.
What my end goal is: Take a piece of an MVC application, customize it and make it a Web Part. I need to be able to modify or access SharePoint content on that site which is why I cannot use an App Part.
Okay.
First install the Office Development Templates from
http://www.microsoft.com/visualstudio/eng/office-dev-tools-for-visual-studio
This will give you the following template selection on reopening Studio
Then navigate to wherever EwsManagedApi32.msi is and enter the following command in an elevated prompt -
EwsManagedApi32.msi addlocal="ExchangeWebServicesApi_Feature,ExchangeWebServicesApi_Gac"
Now your templates are usable and the one you want is "VS2012 Web Part".
Now, by default this will add an ASP.NET project, which is not what you want, so manually delete the ASP.NET project, add an MVC one, highlight the SharePoint project in Solution Explorer, hit F4, and select the MVC project in the "Web Project" dropdown at the bottom of the properties.
And there you go. One controller per web part, sorted.
I am sharing link SharePoint MVC webpart that uses Knock out framework using MVC for SharePoint. It has step by step instructions which might help you.
Hope this will be a good starting point
http://www.codeproject.com/Tips/739445/SharePoint-Razor-View-WebPart

integrating YAF.NET in my MVC3 Razor Solution

I would like to know if there is a way to integrate YAF.NET to my MVC3 Application?
I dont want YAF to be inside my page like using my masterpage or stuff like that, I just want it to be in a subfolder like /forum and if a user clicks the "forum" link he will be redirected to the forum.
In the future I also would like to use a login system for my page, so I have to think about membership provider. I know that there is a way to make YAF use your basic asp.net membership provider but will yaf work with mvc 3 in that way? Since yaf isn't a .NET 4 application I wonder how I could migrate the membership provider?
If there isn't a solution for the membership stuff, I should be able to just link from my page to YAF?
EDIT:
My solution ->
1)I added a subdomain and config both of mine domains to use an A-Record which points to the Server where IIS is running.
2)I added 2 Websites. The first one is my Main Website with my MVC3 Application and the second one is the YAF.NET Forum.
3) I edited the binding settings of both of the websites (IIS Manager -> Sites -> yoursite -> Binding) and removed the IP binding insteed i added a HTTP header. For mainsite = mydomain.com and for the forum forum.mydomain.com
For the first part, you can just install YAF in a virtual directory on your website like www.mywebsite.com/forums/ and let it run standalone there.
Create a new Virtual Directory in the folder you like. (/forums)
Set permissions, .NET settings etc accordingly and install YAF there.
For the second, what you could do is use from your MVC app, directly read YAF's database of users (wherever it is) and use it to authenticate your users.
The Latest build of YAF is on ASP.net 3.5, you could try getting the source and building it for .NET4, although this would not be necessary since you said you don't want to mash your app with it but run it side-by-side and have them interop. (There also is some UserControl feature for CMS's you might want to check that out)
On the features page it says YAF supports asp.net memberships and roles, so you shouldn't have a problem there either.

Rails console alternative for ASP.NET MVC?

The biggest thing I miss from Rails is the super handy console.
Let's say you need to call a certain function on the server that will update the database. In Rails, you just launch the console and call it.
In ASP.NET MVC I have to call it in a controller, rebuild the whole solution, transfer the compiled dll to the server, go to the page that has to call the function (it has to be protected of course), and it's done.
So is there an alternative?
Thank you
I don't know of anything like console for asp.net. But I do know of an alternative to what you're doing because I used to do similar things all the time.
You don't have to upload the newly compiled solution to the server. All you have to do is change your connection string from development to production. Then just run it locally and your production database will be updated.
To organize things a little better I had an admin page where I could do various database management tasks. I'd just create button links on the page for whatever it was I needed to do and all the actions were placed in an admin controller. I set the permissions on that controller so that only an admin could access the actions.
On a side note, why are you going from rails to asp.net MVC? I did asp.net for a few years and rails for a few months now. I find I prefer rails these days a lot more.
Edit: (if you need something quick and dirty)
add a button on one of your existing pages linked to a controller action
point your connection string to the production database
run locally and click the button
Afterwards, remove or comment out the code you just ran.
There is no console per-se built in in ASP.NET (although there is one in Visual Studio) but if your models are independent of the rest of the system you should be able to call them from a command line application (or even a Visual Studio unit test) really quickly.
LINQPad makes an excellent equivalent to Rails Console.. Instructions here:
https://stackoverflow.com/a/9403457/1029644

How to publish an ASP.NET MVC website

I've a site that I'd like to publish to a co-located live server. I'm finding this simple task quite hard.
My problems begin with the Web Deploy tool (1.1) giving me a 401 Unauthorized as the adminstrator because port :8172 comes up in the errors and this port is blocked - but the documentation says "The default ListenURL is http://+:80/MsDeployAgentService"!
I'm loathe to open another port and I've little patience these days so I thought bu66er it, I'll create a Web Deploy package and import it into IIS on the server over RDP.
I notice first that Visual Studio doesn't use a dialog box to gather settings, or use my Publish profiles but seems to use a tab in the project properties, although I think these are ignored when importing the package anyway?
I'm now sitting in the import wizard with Application Path and Connection String. I've cleared the conn string as I think this is for some ASP stuff I don't use but when I enter nothing in the Application Path, the wizard barks at me saying that basically I'm a weirdo because most people publish to folders beneath the root site.
Now, I want my site to be site.com/Home/About and not site.com/subfolder/Home/About and I think being an MVC routed site that a subfolder will introduce other headaches. Should I go ahead and use the root?
Finally, I also want to publish a web service to www.site.com/services/soap which I think IIS can handle.
While typing this question, Amazon have delivered my IIS 7 Resource Kit, and I've been scouring the internet but actually I'm getting more confused.
Comment here seems to show consensus opinion that Publish isn't for production sites and that real men roll their own.
ASP.NET website 'Publish' vs Web Deployment Project
...I guess this was pre- Web Deployment Tool era?
I'm going to experiment on a spare box for now but any assistance is welcome.
Luke
UPDATE
The site was imported (to the root) manually with Web Deploy and it worked. If you get the error "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' " its because your app pool is 4.0 and should be 2.0.
If you are using VS 2010, may I recommend Scott Hanselman's Web Debloyment Made Awesome?
http://www.hanselman.com/blog/WebDeploymentMadeAwesomeIfYoureUsingXCopyYoureDoingItWrong.aspx
Even if you are using VS2008, there are nice concepts there that will probably help.
I've experienced the same frustration and trouble with this as well. Coming from a Java web background where we can package everything as a single WAR and toss it on the server, the deployment process with ASP.NET seems archaic.
I currently have a python script that uses FTP to transfer the needed files to my test instance on the remote server. I have another python script that transfers those files to my live site. These scripts are smart enough to take care of differences between some of the configuration files etc..
I've found it much easier than trying to setup permissions or using the Microsoft deploy tools.
Hi you can use filezilla software to upload

Resources