MVC 5 Website - Shared Hosting - Medium Trust - medium-trust

I recently hosted an asp.net MVC 5 website on shared hosting of hostgator. Its throwing me security errors. I contacted the support and they replied me that the website has to be Medium trust. They cannot offer Full trust as its shared hosting plan. I cannot opt for dedicated server as its too expensive.
My question is can't we build asp.net mvc 5 websites with medium trust. I marked trust level to Medium in web.config and its throwing few other errors. I added [assembly: AllowPartiallyTrustedCallers] to AssemblyInfo.cs. Not much of use.
How to build an asp.net MVC website with medium trust level? I am using Entity Framework.
Thanks,
Fayaz

Related

What's the equivalent of htpasswd in ASP.NET Core

I am working on an ASP.NET Core web application.
Please note I am not working with IIS.
The maintenance team, in charge of the server administration does not have access to the application source code.
Is it possible for the maintenance team to add a user/password restriction to access the application ?
It is possible with a php application running on apache server with .htaccess/.htpasswd mechanism. This mechanism is independent of the application.
Is it possible to do the same with a .NET Core Kestrel web server ?
Thanks

IIS : Host a .net Core application under .net framework Website

Hosting ASPNETCore sub-application under ASPNET .netframework website.
I have a website hosted under IIS which is developed in ASP.NET MVC 4 targeting to .NET Framework 4.0
and i'm trying to add an application developed with ASPNET Core under this website.
are we able to do that ?
(I tried, and its work only if i host them separately in two websites)
There's not enough here to help you, specifically, but generally speaking, this is problematic because ASP.NET Core only uses Web.config to load the ASP.NET Core hosting IIS module, and an ASP.NET site is going to have all sorts of things in its Web.config, including many conflicting HTTP modules.
Web.config is inherited by default. While you can turn off individual sections with inheritInChildApplications="false". You must add this to every, single section in the parent's Web.config, and remember to do any time you add new sections in the future, or it will break you ASP.NET Core app. If you have to, then you have to, but the idea that a change to some other application will potentially break another without any indication that a problem has occurred is a scary prospect to say the least.
It would be far better to just host the ASP.NET Core on a subdomain or something, and let it be its own site.

How to host a WebAPI2 console app in production?

I was reading this article in looking for differences between creating an API using WebAPI and MVC and came across this statement:
In simple load testing on my local machine, I’ve found that Web API
endpoints hosted in console apps are nearly 50% faster than both
ASP.NET controller actions and Web API endpoints hosted within MVC
projects.
As such, I'm interested in how this would take shape in a production environment.
Obviously I'm looking for performance, so I looked into OWIN and self-hosting. However I'm not clear on if this offers the same efficiency as the console app discussed above.
Can someone please explain the proposal of hosting an API console application for consumption in a production environment - i.e. how would you connect a URL to the console app, etc.?
Thanks.
My understanding is self hosted OWIN apps can be run within any kind of app domain e.g console, windows forms, windows service, AWS EC2, Azure Worker Role etc. The application you should run it in is dependent upon the hosting environment you choose, there are lots of options.

Single Sign On With ASP.NET Identity Framework

This question has been asked so many times, and a quick search came up with lot of results. But I haven’t gotten satisfactory answer yet.
We have 2 web applications ( and we may have more in future) App1 is .Net 4 Silverlight Application and App2 is Node.js/Angular application. Both applications have different domains. www.app1.com and www.app2.com The App1 is hosted in IIS and App2 is NOT in IIS
Now, we have to implement Single Sign On Feature to support these applications. I was looking into ASP.NET Identity which is available in .Net 4.5.
Questions
1. So I thought of creating new MVC 5 application using .Net 4.5 that could serve as SSO site. If possible I wanted to use our own SQL server to maintain the credentials. But I am not sure how to share authentication ticket/cookie between sites. I have done this before using Forms Authentication where I had to use same machine key on all websites. But those were all .net applications. However with new identity framework and OWIN and with different types of applications i am not sure. So before I jump into it and start developing I wanted to know is it recommended approach, and if yes, can someone point me in the right direction. An article would greatly help.
2.Second options is to use Azure AD, but I am assuming we have to pay for it( we have MSDN sub) and we do not have local active directory either. Is Azure AD is the right option here? Does it work with Node.Js/Angular application. With Azure AD I guess App1 I may have to upgrade it to .Net 4.5

Hosting for MVC4 projects

I tried searching for a hosting company that would support MVC4 but I couldn't find any - I would like to deploy my MVC4 application online but I do not know a hosting company with good prices.
Could you give me a list?
Bin-deployed MVC 4 apps should run on any hoster that supports MVC 3.
As #marcind suggested, your app will run on any hosting company which supports .NET Framework 4 and integrated mode for application pool. You just need to include the necessary dlls inside the bin folder under root directory.
You also has a way to deploy and run your app on classic mode but you need a little bit more setup. See this post:
Running ASP.NET MVC Under IIS 6.0 and IIS 7.0 Classic Mode : Solution to Routing Problem
As for your request on hosting company suggestion, here is not a place to ask recommendations on buying products or services.
I have deployed Mvc 3 based website by using below tutorial on Mochahost.
Do the Same For MVC 4.(Note : Don't Forget to include necessary dlls).
http://www.mochasupport.com/kayako/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=568