ASP MVC 2 in Sharepoint 2007 Security Exception - asp.net-mvc-2

I am trying to configure ASP MVC 2 Framework to run within a SharePoint 2007 install on IIS 6.0. I have managed to get the two web.config setups together, and made GAC and global.asax changes.
When I try to access the MVC application within the SharePoint domain (http://Sharepoint.com/MVCApp), I get a security exception.
**Source Error:**
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
**Stack Trace:**
[SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
System.Web.Mvc.BuildManagerWrapper.System.Web.Mvc.IBuildManager.GetReferencedAssemblies() +14
System.Web.Mvc.TypeCacheUtil.FilterTypesInAssemblies(IBuildManager buildManager, Predicate`1 predicate) +88
System.Web.Mvc.TypeCacheUtil.GetFilteredTypesFromAssemblies(String cacheName, Predicate`1 predicate, IBuildManager buildManager) +65
System.Web.Mvc.AreaRegistration.RegisterAllAreas(RouteCollection routes, IBuildManager buildManager, Object state) +80
System.Web.Mvc.AreaRegistration.RegisterAllAreas(Object state) +55
System.Web.Mvc.AreaRegistration.RegisterAllAreas() +7
CapExRequest.MvcApplication.Application_Start() in C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\CapExRequest\CapExRequest\Global.asax.cs:29
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3614
I have tried adding permissions to the MachineName\ASPNET account for the \MVCApplication as suggested in one article. No joy.
Other occurences seem to be related to accessing a remote file share. There is no remote file share in my instance.
Any thoughts, suggestions, answers??

So, here is what the setup is, and the steps taken to get it all together...
Followed basic instructions for
running an ASP.NET MVC application in SharePoint (see link below), but I put the
custom MVCHttpApplication in it's own
project and created a standalone
assembly;
Updated SharePoint to include AJAX
3.5 (ours was only referencing 1.0 standalone);
Built a signed application and
deployed to the virtual directory,
including adding the application
assembly in the GAC.
Actually pretty straight-forward so far. It just took a while to come to my senses.
"Using ASP>NET with Sharepoint Publishing" http://vspug.com/mbailey/files/2010/04/Using-ASP.NET-MVC-2-with-Sharepoint-Publishing.pdf

Related

How to deploy ASP.NET MVC4 application with SQL Server CE to Azure website

I deployed a ASP.NET MVC4 app with SQL Server CE database, but I'm getting
Sorry, an error occurred while processing your request
I am using VS2012 to publish this app to azure website. How can I solve this issue? Thanks.
To summarize and so an answer can get marked on this to help the next person that comes by.
When running into issues on azure-web-sites FTP is a handy debugging tool which enables you to:
Verify that the dll exists in your bin directory
Sometimes the .gitignore file blocks directories from being checked in
Verify that your web.config file has the proper version of the assembly configured
NuGet can help, but it's ultimately up to you to verify your dependencies
Here is a good article to follow on the subject: http://www.dotnetcurry.com/showarticle.aspx?ID=883
Unfortunately with VS 2013 Compact edition is not supported any more, so things are somewhat tricky.

How to deploy an Orchard CMS web project to a Windows Azure Cloud Service?

Basically, I want to be able to deploy a Orchard CMS web application to a windows azure cloud service. I v'e tried following the same steps as I would normally do for any other web application but it just never works.
UPDATE
I downloaded the Orchard.Source.1.5.1 from orchardproject.net website. Added my custom modules and themes. Published the web application to a local folder. That would result in a Orchard web application. I open this web application, add the Windows Azure Cloud Service project and my web application is the web role in this project. I set up DataConnectionString to my azure cloud storage with my name and key. Published to Azure.
Once the deployment is over when I go to the site url to see the result I get this the YSOD with the following exception:
Server Error in '/' Application.
None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func1[Autofac.Features.OwnedInstances.Owned1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Autofac.Core.DependencyResolutionException: None of the constructors found with 'Public binding flags' on type 'Orchard.Environment.DefaultOrchardShell' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Mvc.Routes.IRoutePublisher routePublisher' of constructor 'Void .ctor(System.Func1[Autofac.Features.OwnedInstances.Owned1[Orchard.Environment.IOrchardShellEvents]], System.Collections.Generic.IEnumerable1[Orchard.Mvc.Routes.IRouteProvider], Orchard.Mvc.Routes.IRoutePublisher, System.Collections.Generic.IEnumerable1[Orchard.Mvc.ModelBinders.IModelBinderProvider], Orchard.Mvc.ModelBinders.IModelBinderPublisher, Orchard.Tasks.ISweepGenerator)'.
UPDATE:
I followed the guide in the orchard project website "Deploying Orchard to Windows Azure" and didn't touch anything, just got all the source code from the repository, ran ClickToBuildAzure from the Visual Studio 2010 command line, didn't get any error messages, set up my storage in the ServiceConfiguration file and uploaded my package and ServiceConfiguration files. Deployment went ok. I got to the Orchard Get Started screen but after input all the information, including a connection string to my SQL Azure DB (got the connection string from Azure Portal and inserted my password), I got the following error:
Setup failed: An exception was thrown while invoking the constructor 'Void .ctor(Orchard.Environment.Configuration.ShellSettings, Orchard.Data.ISessionLocator, System.Collections.Generic.IEnumerable`1[Orchard.Data.Migration.Interpreters.ICommandInterpreter], Orchard.Data.ISessionFactoryHolder, Orchard.Reports.Services.IReportsCoordinator)' on type 'DefaultDataMigrationInterpreter'.
I didn't even get to the AddingaModuletotheDistribution point.
The guide provided by the Orchard Team is not the ideal solution for me.
I have developed custom modules and themes and I work in a development environment with Visual Studio and TFS and would not like to use it with WebMatrix and and deploy to Azure Web site.
I downloaded the source code from the orchard website and added an azure web role project.
By the way, I've checked this question and this blog post and still could not resolve my problem.
Everything I find regarding this is fairly outdated!
I am almost giving up. Could anybody tell me if this is possible? Or the only way to work with Orchard is WebMatrix?
You need to read the documentation more carefully, as adding modules and themes is covered here: http://docs.orchardproject.net/Documentation/Deploying-Orchard-to-Windows-Azure#AddingaModuletotheDistribution
You need to add your modules and themes to the Azure solution, not the Orchard solution the is in src. Once you've done that, the ClickToBuildAzure script will generate a package that contains your modules and themes, and that will deploy well to Azure.
You could try http://docs.orchardproject.net/Documentation/Building-and-deploying-Orchard-from-a-source-code-drop This solved the exact same exception for me just now, but I built with the intent to run on IIS rather than Azure.
Didn't investigate to figure out what the steps in the link did to satisfy the IoC container that was not satisfied by doing a regular file system publish.

weborb and wcf service library with ado .net entity framework

i've created a wcf service library with ado .net entity framework to handle the retrieving of data from the database and send it to the user.
i've been testing it in visual studio without any problems.
so, i moved the dll of the service and the xml configuration file to the bin folder of weborb, changed the web.config to add my service.
but when i invoke the service from the webconsole i get this error:
>The server was unable to process the request due to an internal
>error. For more information about the error, either turn on
>IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute
>or from the <serviceDebug> configuration behavior) on the server in
>order to send the exception information back to the client, or turn on
>tracing as per the Microsoft .NET Framework 3.0 SDK documentation and
>inspect the server trace logs"
can anyone give any help with this?
how can i get a working wcf service library using ado .net entity framework in weborb?
help would be appreciated.
thanks in advance.
Have you checked the WebORB log?
Then start off by trying the WebORB examples from here.
The WebORB log should give you more detail about the error. With that info, I would post a question on the WebORB forum.

Azure error when using EF agains SQL Server CE 4.0 database

I have an ASP.NET MVC 3 application which I want to deploy to Azure. The application uses EF against a SQL Server CE 4.0 database in the App_Data directory.
The site runs fine locally but when I reference it from an ASP.NET MVC 3 web role and publish it to Azure I get this error:
"Unable to find the requested .Net Framework Data Provider. It may not be installed."
The full exception can be viewed here: http://52df5a4a5c1b4d10a927078bb8a06d15.cloudapp.net/drug
Here is connection string from the web.config file:
<add name="DbEntities" connectionString="metadata=res://*/AMDBModeledmx.csdl|res://*/AMDBModeledmx.ssdl|res://*/AMDBModeledmx.msl;provider=System.Data.SqlServerCe.4.0;provider connection string="Data Source=|DataDirectory|\AMDB.sdf"" providerName="System.Data.EntityClient" />
I have tried compiling my project to target x86 and setting the "Copy Local" property of the System.Data.Entity reference to true. Nothing helps.
Is it possible to run a web app in Azure and use a file-based database? I understand this can be a problem with multiple instances, but I'm only using a single VM.
I can't see your error page, but it looks like the SQL CE Data Provider DLL is missing. Have you tried following these instructions?
http://blogs.msdn.com/b/webdevtools/archive/2011/01/06/how-to-bin-deploy-sql-compact-edition-4-0-and-razor-web-projects.aspx

Deploying ASP.Net 4.0 website on IIS 6.0

I recently upgraded an ASP.Net 2.0 website to ASP.Net 4.0 using VS2010 upgrade option.
Website works fine in cassini and even on our Windows 2003 server with IIS 6.0
But it will not come up on the client's environment.
Client too has a Windows Server 2003 with IIS 6.0 and .NEt Framework 4.0 installed.
I have registered ASP.NEt 4.0 with IIS 6.0 using
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis –ir
also configured the website with .NEt framework 4.0 like below
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>ASPNET_REGIIS -norestart -s "W3SVC
/1/ROOT/Website"
I have assigned the website a separate apppool dedicated to it.
I have tried restarting IIS and the machine but to no avail.
I have verified that under "Website Extensions" ASP.NEt 4.0 is allowed and also checked the site's configuration to confirm that .aspx among other is mapped to .NEt 4.0
I have given the internet user read access to the website directory.
I have been getting
"Server Application not available"
I also getting the following in the event log
Failed to initialize the AppDomain:/LM/W3SVC/1/Root/Website
Exception: System.IO.FileLoadException
Message: Could not load file or assembly 'System.Web, Version=4.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.
Access is denied.
Another one after this event is
Failed to execute request because the App-Domain could not be created.
Error: 0x80070005 Access is denied.
Website uses Active Reports 6.0 and elmah. That's it.
I would appreciate any tips/pointers to figure this issue out.
Thanks
I could not get the above scenario to work.
So I downgraded the website to .Net 3.5 which uses Framework 2.0 and this made deployment painless.
Not sure what it was about asp.net 4.0 and IIS 6.0 but I could not get to work in the client't environment even though I had it working in our test environment.
If you end up getting in a similar situation again (or for anyone else landing on this from a search), try granting the IIS User access to the 'Temporary ASP.Net Files' folder (under a relavant folder in C:\Windows\Microsoft.Net).
I've run into this a couple of times and that generally seems to work at least in my development environment. You'll likely want to do a bit more research before applying this in production.