I added NLog to my project. Following the instructions I created NLog.config.
<?xml version="1.0" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="file" xsi:type="File"
layout="${longdate} ${logger} ${message}"
fileName="${basedir}/${shortdate}.log" />
</targets>
<rules>
<logger name="*" minlevel="Debug" writeTo="file" />
</rules>
</nlog>
and then just log something.
var logger = LogManager.GetCurrentClassLogger();
logger.Info("xxxx");
With the developer web server it work fine, but when I publish the app to IIS, no logs are created.
Edit website permissions in IIS and under security tab give IIS_IUSRS group full privileges.
In Application, Pools find the pool your application is using and set some specific user.
The image below describes the procedure step by step:
Does NLog.config have the property "Copy to Output Directory" set as "Copy always"?
One of the problem is IIS doesn't have permission to write in log file. If you are sure you have NLog.Config in your release and the log file is still not generating then give full access to your IIS application pool.
You can add "throwExceptions="true" to your nlog config to see what is the problem. Should be something like this:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="true"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
After you are sure about it is access problem you can do like below for giving access to your application pool.
First find your application pool (in case you don't know) :
On IIS manager right click your web page name.
On Manage Website tab click Advanced Settings.
You will see Application pool name on top.
Give full access to your application pool :
On IIS manager right click your web page name.
Click Edit Permissions.
Select Security Tab on opened window.
Click Edit button
Select your application pool name. (If your application pool is not in the list then you have to add it)
And at down select full access and than select ok and leave.
Related
I am attempting to have seamless movement between locally testing and cloud testing of my Azure Web App. The following is a snippet from my Web.Config file.
<appSettings>
<add key="ida:ClientId" value="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" />
... more items ...
</appSettings>
The value of ClientId corresponds to the value of an "App Registrations" object within my Azure Active Directory instance. When I click on that object and navigate to Settings --> Reply URLs, the entry is https://localhost:xxxxx/.
My problem is: When I publish the Azure Web App to the cloud, I am redirected to the above localhost URL. However, if I add another Reply URL entry of https://mywebappname.mydomain.com, then when I attempt to test locally, I am redirected to the web URL instead of the localhost URL.
I would like a method of seamless local and cloud testing: When testing locally and on the cloud, I would like to be redirected to the correct URL. What configurations am I missing in order to accomplish this?
---- UPDATE ----
Also when I right click on the Web Application project in Visual Studio 2017 and then click Properties, I am taken to this screen. Here are some additional properties I have set, which redirect to https://localhost:xxxxx/. Do I need to change this? And if so, how can I have both redirect URLs within the project's properties?
I ended up solving this problem by using the Web.config Transformation Syntax (see Stephen Muecke's link in the comments on the original post).
In the same directory as the Web.config, I added a Web.Release.config. Now, if in Visual Studio I select "Release" build, then the Web.Release.config transform config file will be used to replace the Web.config file's "ida:RedirectUri" key with the value in the transform config file.
Here is the Web.Release.config
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=301874 -->
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings>
<add key="ida:RedirectUri" value="https://<mywebappname>.<mywebappdomain>.com/" xdt:Transform="Replace" />
</appSettings>
</configuration>
And here a snippet from the very large Web.config
<?xml version="1.0"?>
<!-- For more information on using Web.config transformation visit https://go.microsoft.com/fwlink/?LinkId=301874 -->
...
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
...
<appSettings>
<add key="ida:RedirectUri" value="https://localhost:xxxxx/" xdt:Transform="Replace" />
...
</appSettings>
...
</configuration>
That way, redirecting to localhost is the default.
I published an intranet on IIS 7.5. If I try to go to the website, I get "403 - Forbidden: Access is denied - You do not have permission to view this directory or page using the credentials that you supplied".
If I right click on the application folder on IIS Manager and go to Manage Application and then Browse, I get "HTTP Error 403.14 - Forbidden - The Web server is configured to not list the contents of this directory". It then proceeds to tell me that A default document is not configured etc. etc. I do have a default document listed in the web.config file as follows:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
<modules runAllManagedModulesForAllRequests="true" />
<defaultDocument>
<files>
<add value="Index.cshtml" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
What am I doing wrong? Many thanks.
check the folders permissions: right click on the folder, click on properties go to Security and add the appropriate user (like IUSR_...). hope it helps.
It turned out I was publishing the app completely the wrong way. I was going by how previous ASP.Net apps created as Websites and not Solutions were published. This MVC app needed to be placed in inetpub/wwwroot folder in the server. If I published through Visual Studio I think this would have happened anyway. I didn't have VS in the server. So I placed the files manually there (just copied from my local inetpub/wwwroot since I successfully published there earlier). The last thing I needed to do was go to IIS Manager and converting the project folder into an Application. Now cooking on gas.
I'm trying to split ASP MVC areas into separate applications within New Relic.
Within each area I have created a new web.config file that simply contains the below XML. This doesn't seem to be creating a new application like I would expect it to.
It works when it is in the root web.config. I don't have this key in the root config of this MVC application, however.
Any help would be appreciated - otherwise it might just be something that cannot be done?
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="NewRelic.AppName" value="My Area Name" />
</appSettings>
</configuration>
The New Relic .NET agent can only gather settings from a web.config file in the app root. Unfortunately, there isn't a way to set NewRelic.AppName on the fly using the API or specify a path for per-app config files. You might write into support#newrelic.com and submit a feature request.
First of all, this is my third question on the similar topic.. and still I have no answer, maybe only approaching it (see first, second).
My web application (ASP.NET MVC3 under IIS 7.5) runs git to access some github repositories. After I upgraded my workstation to Windows SP1 it stopped to work. The reason was that as soon as git started, it actually runs ssh.exe to communicate with github. The ssh.exe appears to hangs up, so all application hangs.
The application pool used by that application use the same process identity as myself. But using ProcessHacker I can see following picture:
Because of USERPROFILE is pointed to /system32/config/systemprofile ssh.exe is expecting to have .ssh folder, that contains public/private keys. Since keys are not there it hangs.
But keys are typically in ~/.ssh (in my case c:\users\alexander.beletsky.ssh). As soon as I copied keys into /system32/config/systemprofile application started to work as expected.
My question is, why does w3wp.exe thinks that its profile in /system32/config/systemprofile? is it possible to change that? it is expected behaviour for application pool or just issue of my machine?
Waiting for any clues!
EDIT
Load User Profile property of Application Pool is set to TRUE.
ssh.exe is actually using HOME environment variable. Check if it set correctly.
As my machine on which this works has the same value in enviroment page of process hacker, and still
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) has value of my user appData, and I have SP1, I think that it should not be related to it, but to something in your configuration that could have been changed. Check if your inetmgr has properly set identity for your application. Open C:\inetpub\temp\appPools\yourAppPoolName\yourAppPoolName.config and check if this setting exists:
<configuration>
....
<system.applicationHost>
<sites>
<site name="Default Web Site" id="1" serverAutoStart="true">
<application path="/yourAppPath" applicationPool="yourAppPoolName">
<virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot\yourAppPath" userName="yourUserName" password="[enc:AesProvider:someHashHere=:enc]" />
</application>
...
</site>
</sites>
<system.applicationHost>
<configuration>
If not, you can configure it there (put password in plain text or you can configure it using inetmgr like I described in my answer to your other question).
Has anyone been successfully rendering charts using fusion charts in a sandboxed solution?
How would you get the SWF file onto SharePoint? I included it and deployed it via feature and the Elements.xml looks like the following:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="FusionCharts">
<File Path="FusionCharts\FCF_Column2D.swf" Url="FusionCharts/FCF_Column2D.swf" />
<File Path="FusionCharts\FCF_Gantt.swf" Url="FusionCharts/FCF_Gantt.swf" />
</Module>
</Elements>
When the sandbox solution is deployed, you can access the SWF file from http://sharepointsite/FusionCharts/FCF_Gantt.swf, the browser will attempt to open/save the file. If this file is deployed via farm solution, and be deployed to _layouts folder, which I can access via http://sharepointsite/_layouts/FusionCharts/FCF_Gantt.swf, it renders with error message "invalid xml data". The farm solution deployment is correct because MIME type is properly set to "application/x-shockwave-flash" and thus my custom web part which renders chart using this SWF file works. But if my sandboxed web part is to use the SWF file deployed as site pages, it does not work. Any idea?
Thanks in advance.
Sean
The problem is resolved with help from DevExpress team. Though SWF can be deployed to SharePoint site document library, you would need Farm Administrator to go into Central Admin pages and set the property in Application Management for the Web application to allow "Permissive". Go to Central Admin -> Application Management -> Select Web Application -> General Settings (Ribbon button), change "Browser File Handling" from "Restrict" to "Permissive".