Automatically deploy resource files to Central Administration's App_GlobalResources folder when deploying a solution to a web application - sharepoint-2010

I'm developing a SharePoint 2010 solution which consists of some web parts and other components. Furthermore the solution needs a application pages in the Central Administration for configuration.
So my solution contains an extra feature which places a custom actions in the Central Administration menu that links to a application page providing the configuration. The feature has the scope WebApplication and uses the Attribute AutoActivateInCentralAdmin set to True so the feature is automatically activated in the Central Administration when the solution is deployed to a web application. This part of my solution works as expected.
But I've got some issues regarding the resource files which are used by the application pages in the Central Administration as they only get deployed to the App_GlobalResources folder of web application the solution was deployed to but not to the App_GlobalResources of the Central Administration.
So I'm wondering why to use the AutoActivateInCentralAdmin when there is no automatic deployment of the resource files to the App_GlobalResources folder of Central Administration.
What is the best way to deploy the resource files to the Central Administrations App_GlobalResources folder whenever the solution is deployed to any web application in the farm? Is there an automatic way to this?

We are talking about Application resources here (as opposed to provisioning resources) and they should be deployed to {SharePointRoot}\CONFIG\Resources folder. Make sure the resources files used by your application pages are deployed to that folder when your WSP is deployed.
When a new web application is created, the resources are initially copied to the App_GlobalResources folder, you are fine here.
But when web application is already created (which is your case), you need the resources to be copied to existing web applications. You can do this manually with this command
stsadm –o copyappbincontent
Or you can automate (which is what you want) this by including the following in your FeatureActivated event in your feature receiver. For Central Administration resources and site maps, call
SPWebService.AdministrationService.ApplyApplicationContentToLocalServer();
For regular application page resources and site maps,
SPFarm.Local.Services.GetValue().ApplyApplicationContentToLocalServer();

You need to create a Custom Timer Job for this. If you search on internet, some people have already developed such job.

Related

Set up Application Insights for Older WCF Library

I've "setup" AI through the context menu in VS 2017 when selecting the "Configure Application Insights" option. It doesn't set up like ASP.NET sites. it didn't add AI dll's and there isn't a ApplicationInsights.config
But it does state I've connected to the AI i created in Azure. yet i don't see the instrumentation Key anywhere. Also When I rum the WCF service noting gets logged. is there a specific way we need to set up AI for this? I couldn't find articles on how to do this. The only files that were generated was in the Connected Services AI folder and ConnectedService.json
I figured out the issue, of TFS for some reason it didn't allow checkout of project file so it created the files but couldn't add it to the project. I checkout the project manually and delete the files. Then added AI and it worked as expected.

in virtoCommerce, when Deploy web applications to dedicated server, How to configure "ContentConnectionString" of storefront?

I've studied the link below:
Storefront Source Code Getting Started.
According to the "Configuring content connection string" Section, I realized that the need to be placed physical address of "cms-content" of admin.
but We've deployed web applications(admin and storefront) to dedicated server.
So for a configuration with these conditions I read the link below:
Deploy web applications to dedicated server
But this link is not yet clear how the "ContentConnectionString" was initialized.
ContentConnectionString storefront setting pointed to place where themes files stored and has default value ~/App_Data/cms-content.
VC platform, with installed module vc-content allows to manage themes files from manager UI and have similar setting CmsContentConnectionString.
If storefront and platform have installed on same Azure apps or dedicated server this both settings should pointed to same physical place and have follow valuesprovider=LocalStorage;rootPath=~\App_Data\cms-content in platform Web.config and provider=LocalStorage;rootPath={ vc-platform physical path}\App_Data\cms-content in storefront Web.config.
For case when VC platform and storefront have separated installation need to use azure blob storage provider=AzureBlobStorage;rootPath=cms-content;DefaultEndpointsProtocol=https;AccountName=yourAccountName;AccountKey=yourAccountKey to share themes files between storefront and platform.
We strongly recommend use store and change your theme in GitHub repository and use CI (continuous integrations tasks) for update themes on production and use admin UI theme management only for emergency fixes or other not historical changes.

How to make use of common files across projects using an IIS7 virtual directory

The scenario:
I'm very new to ASP.Net MVC programming and running into a wall constantly trying to make use of common files (.js, .css) across multiple projects.
The idea is to have these generic files in 1 location which provides for easy future updates and avoids the "copy and paste" dilemma across all the projects. I've set this folder up in IIS7 as a virtual directory in the default website with an alias "CommonFiles".
The problem:
With MVC-4 I'm trying to add the js files to a script bundle but upon running the application it's not picking the files up at all. (checked in the page source and also added a js function as a test)
Code snippet in BundleConfig.cs:
bundles.Add(new ScriptBundle("~/bundles/test").Include("~/CommonFiles/test.js"));
Rendering in _Layout.cshtml:
#Scripts.Render("~/bundles/test")
I've read quite a few posts (
Script Bundling in WebForms with Virtual Directories (asp webforms though), How to add reference to System.Web.Optimization for MVC-3-converted-to-4 app, ScriptBundle not rendering scripts that are in a VirtualDirectory) but i'm afraid my lack of knowledge on MVC is limiting my path forward and really hoping to get some insight into how MVC handles IIS virtual directories and if it's even an easy possibility given the last post i've read above.
Can this be done in MVC-4 and if not what is a second best alternative in reusing common code across projects?
After reading a post by kev (Using ServerManager to create Application within Application) it put me on the right path and the issue I had is actually embarrassing.
For the sake of other devs landing on this post with a similar issue in visual studio, this is what fixed my issue:
Problem:
I make use of a separate project which contains files that are used across multiple other projects. I created a virtual folder in IIS7 referencing these files. This means if a change is needed to the common files, it's updated once and all the other projects will automatically "see" the change.
My other individual projects make use of script bundling to include files relevant only to the said project, but also to reference the common files in the virtual folder as defined in IIS.
My MVC-4 web application wasn't picking up the common files given the syntax above, in neither debug or release..
Solution:
When developing in VS2012, under the project's properties, there's a setting under the web tab where you can specify whether you want to use local IIS web server or IIS Express to test your application. IIS Express adds a random port to the site in order to test, and to allow multiple instances of sites to run (on different ports). This seems to throw the virtual directory include off in the bundling.
Choosing to use the local IIS server is closer to what the "live" environment would be in my opinion. Just un-tick the "Use IIS Express" setting.
As a side note and for more info on what the difference between the usage of IIS and IIS express is and whether it's suitable for your environment (as it was for mine) see this link:
http://msdn.microsoft.com/en-us/library/58wxa9w5.aspx
Hope this helps someone in future and saves them the amount of time I wasted on this!

How to deploy a web site on IIS by using .dll file

I want to deploy on IIS my web site but I do not want to take whole project. I just need to take .dll file. Is their any way to do so.
I do not want to use visual studio only .dll file from the project to deploy.
The basic steps for deploying to IIS on windows server are as follows:
log onto the machine that is or will be hosting your application.
Use IIS Manager to create a new website for your application.
Create a new application in that site. I believe this also will automatically create an application pool with the same name for you and use it by default.
Specify the virtual directory for your application. This is going to tell IIS where to look for your mvc application. For this case lets assume it is C:\myApp
On your own machine Build the application however you build it with the correct solution configuration (i.e. Release mode). Let say the result of your build is located at C:\MyProject\bin
Copy C:\MyProject\bin from your machine onto your hosting machine at C:\myApp
You should be able to search these steps and find a step by step guide of how to accomplish them. Here is a link to some info on what sites, applications and app pools are to help you better understand.
http://www.iis.net/learn/get-started/planning-your-iis-architecture/understanding-sites-applications-and-virtual-directories-on-iis
Based on your sites requirements there will be some additional steps to set up security and alter bindings if you need to change them.
You don't need to deploy your entire website if you only make a change in a single assembly. You could copy the .DLL assembly directly to the bin folder of your website. This will trigger the Application Pool to be recycled in IIS and the changes will be taken into effect on the next request.

What is the difference between sandboxed and farm solution in SharePoint 2010

I am new to SharePoint 2010. What is the main difference between sandbox and farm solution. Can you give me 5 differences to remember. I googled, but there is lot of matter to understand. As a start up guy, i want to know the basic difference.
Thanks for your help.
Farm Solution:
Farm solutions, which are hosted in the IIS worker process (W3WP.exe), run code that can affect the whole farm. When you debug a SharePoint project whose Sandboxed Solution property is set.
Sandbox solution:
Sandboxed solutions, which are hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe), run code that can only affect the site collection of the solution. Because sandboxed solutions do not run in the IIS worker process, neither the IIS application pool nor the IIS server must restart. Visual Studio attaches the debugger to the SPUCWorkerProcess process that the SPUserCodeV4 service in SharePoint automatically triggers and controls. It is not necessary for the SPUCWorkerProcess process to recycle to load the latest version of the solution.
For more please refere this link
You can also refere this to know sandbox solutions goodlink
Farm Solutions:
Farm solutions are hosted in the IIS worker process (W3WP.exe).
If you run any code in farm solution the whole farm will got affected.
If you deploy any feature or retract any feature the whole application pool got recycled.
Since they are scoped as farm level, they have full trust access to all the resources.
When the Sand boxed Solution property is set to False, selecting Build\Deploy will deploy the solution to the Farm Solution Gallery.
Sand boxed Solution:
Sand boxed solutions are hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe).
try to this link
- The process runs under a CAS policy that restricts programmatic access to any resource outside the sandbox.
- So it never restart the IIS application pool.
- If you run any code it will affect only the site collection of the solution.
- Helpful if you have shared hosting.
- When the Sandboxed Solution property is set to True, selecting Build\Deploy Solution deploys the solution to the site collection Solution Gallery.
One major difference in the deployment is Farm solutions are installed and deployed. Sandboxed solutions are uploaded and activated.
This Link http://www.enjoysharepoint.com/Articles/Details/differences-between-sandboxed-and-farm-solutions-i-66.aspx
Farm solutions, which are hosted in the IIS worker process (W3WP.exe), run code that can affect the whole farm.
Sandboxed solutions, which are hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe), run code that can only affect the site collection of the solution.
(from http://msdn.microsoft.com/en-us/library/ee361616.aspx)
One major difference is we can't create Aplication pages in Sandbox solutions.Beacuse Application pages are stored in the 14\TEMPLATES\_LAYOUTS and when we deploy as sandbox we dont have permissions to the physical folder.
Also we cant create VISUAL web parts in Sandbox soultions.
We cant use code to connect to the external web services or to database in the sandbox soltion
Farm solutions are installed and deployed. Sandboxed solutions are uploaded and activated.
Normally we are using Sandbox solution for Online sharepoint such as office365. In this case user will get a solution to work with, but not the Physical system folders. So we cant give any images or contents into the Layout folder(it is restricted). And the main thing is We couldn't able to use some SP-class features in the Sandbox solution(which can be get the information about other farm solutions and server information). Thus farm solution is restricting this SP classes, system folders along with SPUCWorkerProcess process.
We can create the Visual Webparts as Sandbox solutions in 2013 but we have to make sure about the classes and we never want to use the layout folders etc.
Farm Solutions properties:
Farm solutions are hosted in the IIS worker process (W3WP.exe).
If you run any code in farm solution the whole farm will got affected.
If you deploy any feature or retract any feature the whole application pool got recycled.
Since they are scoped as farm level, they have full trust access to all the resources.
When the Sand boxed Solution property is set to False, selecting Build\Deploy will deploy the solution to the Farm Solution Gallery.
One major difference is we can't create Aplication pages in Sandbox solutions.Beacuse Application pages are stored in the 14\TEMPLATES_LAYOUTS and when we deploy as sandbox we dont have permissions to the physical folder.
Also we cant create VISUAL web parts in Sandbox soultions.
We cant use code to connect to the external web services or to database in the sandbox soltion
Farm solutions are installed and deployed. Sandboxed solutions are uploaded and activated.
Farm solutions, which are hosted in the IIS worker process (W3WP.exe), run code that can affect the whole farm.
Sandboxed solutions, which are hosted in the SharePoint user code solution worker process (SPUCWorkerProcess.exe), run code that can only affect the site collection of the solution.
Please look the website that contains more details about the Farm Solutions and Sandbox Solution details :
http://www.techcontents.com/uncategorized/difference-farm-solutions-sandbox-solutions-sharepoint-2010/