app.config in other directory - directory

A web service client (WCF) is compiled as a DLL, then comes the dll into the folder "c:\windows\assembly" ... just like I can now say that my DLL in C:\client\client.dll.config is expected?
It would perhaps also the possibility that the program store directly, the problem is that it starts from a SharePoint workflow that is surely not quite that simple.
It may sound silly, but the problem sounds so simple ... Unfortunately I have found so far after a while no concrete solution to Find.
EDIT:
No idea? It is the despair, I am running out of time and I have so much work to implement all this, and such a ridiculous number of hours to keep me?
I've found a lot in terms of editing files, but I will not change it I will change only the access to another directory where the file is ...
In the proxy classes, we refer only so eager ...
[System.ServiceModel.ServiceContractAttribute
(Name = "_-ASD_-CAS01D0005P0000013203",
Namespace = "urn:sap-com:document:sap:soap:functions:mc-style",
ConfigurationName = "_ASD_CAS01D0005P000001320")
]
There must theoretically be possible to simply change the ...
I'm just trying to throw it somewhere in the folder of SharePoint, there is the program being started. The file is from "C:\Windows\system32\inetsrv" started, but on this directory, the dll probably does not have access, because I still get the same error as if there was no config file there.
The file is from "C:\Windows\system32\inetsrv" started, but on this directory, the dll probably does not have access, because I still get the same error as if there was no config file there.

Finally solved by
AppDomain.CurrentDomain.GetData ("APP_CONFIG_FILE");
I can not find it an addictive client.dll.config, but instead the web.config in SharePoint virtual directory "c:\inetpub\wwwroot\wss\Virtual Directories\80\" searches. I added the information there and it works fine!

Related

NET5 + F# - How to build several console applications into one folder

Let's say that I have two F# projects targeting NET5 and producing console applications. Let's call them MyService and MyAdminConsole. When I build the solution, then the folders, e.g. ...\MyService\bin\x64\Debug\net5.0 and ...\MyAdminConsole\bin\x64\Debug\net5.0 will contain:
...
appsettings.json
...
MyService.exe
MyService.dll
MyService.deps.json
MyService.runtimeconfig.json
MyService.runtimeconfig.dev.json
...
and
...
MyAdminConsole.exe
MyAdminConsole.dll
MyAdminConsole.deps.json
MyAdminConsole.runtimeconfig.json
MyAdminConsole.runtimeconfig.dev.json
...
where appsettings.json, obviously, exists only in MyService because it is the service, which needs the settings.
Now, I want to build both the service and the admin console into the same folder so that admin console could have access to the same appsettings.json and I stress the same appsettings.json, not a copy of it.
This seems straightforward, right? Just add a reference to MyAdminConsole into MyService project. However, when I rebuild the solution, then MyAdminConsole.exe and MyAdminConsole.dll are copied into ...\MyService\bin\x64\Debug\net5.0 but MyAdminConsole.*.json are not. Subsequently, MyAdminConsole won't work from that folder.
Sure, I can add post build steps and actually copy these json files where needed. However, that seems ugly and just plain wrong.
I wonder what is a proper solution? Thanks.
PS This is probably applicable to C# solutions as well but I have not checked that yet.
If I understand your issue correctly then please take a look at the workarounds proposed in https://github.com/dotnet/sdk/issues/1675

Runtime error but project compiles fine - Imports/using missing

I am very confused right now. I have VS2008 at my job right now and I have a weird behavior that I have been searching for a while now.
When I compile the project, it works fine, but in runtime I have an error saying object not defined or something like that. The problem is that the imports/using is missing in my class but why does it compile?
In fact, I want to be able to see that error when compiling not when running the webapp.
REEDITED: Here is an example. Lets say i want to use a typed list, I am declaring my object list(of int) for example without having added my imports (system.collection.generic) in the class. then I compile, it works and then I run it, it fails because of the imports missing. is this normal behavior or not?
REREEDITED: I just noticed that the DLL of all my references were not copied in my bin folders even though all of them are set to "Copy local = true". Is it possible that it has to do with our shared directory (all external dlls) being on a network drive (\server\shared). I am really out of ideas on this issue....
problem was because we were having the classes in the app_data folder
The answer to the current question - why you are getting this error - is that ASP.NET does not show many errors at compile-time. You will need to manually go through the application to verify that all pages work correctly. This is very common with ASP.NET development, due to the nature of the environment.
If you post the real errors (probably should be as another SO question), we can perhaps help you with them.
Remove all the dll, etc from bin...
rebuild the whole solution then run
It should run fine...

web.config - auto generate a release version

Simple task, but for some reason no simple solution just yet.
We've all got web.config files - and I haven't worked anywhere yet that doesn't have the problem where someone yells across the room "Sh*t, I've just uploaded the wrong web.config file".
Is there a simple way of being able to auto generate a web.config file that will contain the right things for copying to release? An example of these being:
Swap connection string over to use live database
Change
Switch over to use the live/release logging system, and live/release security settings
(in our case we need to change the SessionState mode to InProc from StateServer - this isn't normal)
If you have others, let me know and I'll update it here so it's easy for someone else to find
Maintaining 2 config files works, but is a royal pain, and is usually the reason something's gone wrong while you're pushing things live.
Visual Studio 2010 supports something like this. Check it out here.
How are you deploying your builds. In my environment, this used to be a pain point too, but now we use cruisecontrol.net and script our builds in nant. In our script, we detect the environment and have different versions of the config settings for each environment. See: http://www.mattwrock.com/post/2009/10/22/The-Perfect-Build-Part-3-Continuous-Integration-with-CruiseControlnet-and-NANT-for-Visual-Studio-Projects.aspx for my blogpost onthe subject of using cruisecontrol.net for build management. Skip to the end fora brief description of how we handle config versions.
In my most recent project I wrote a PowerShell script which loaded the web.config file, modified the necessary XML elements, and saved the file back out again. A bit like this:
param($mode, $src)
$ErrorActionPreference = "stop"
$config = [xml](Get-Content $src)
if ($mode -eq "Production")
{
$config.SelectSingleNode("/configuration/system.web/compilation").SetAttribute("debug", "false")
$config.SelectSingleNode("/configuration/system.web/customErrors").SetAttribute("mode", "off")
$config.SelectSingleNode("/configuration/system.net/mailSettings/smtp/network").SetAttribute("host", "live.mail.server")
$config.SelectSingleNode("/configuration/connectionStrings/add[#name='myConnectionString']").SetAttribute("connectionString", "Server=SQL; Database=Live")
}
elseif ($mode -eq "Testing")
{
# etc.
}
$config.Save($src)
This script overwrites the input file with the modifications, but it should be easy to modify it to save to a different file if needed. I have a build script that uses web deployment projects to build the web app, outputting the binaries minus the source code to a different folder - then the build script runs this script to rewrite web.config. The result is a folder containing all the files ready to be placed on the production server.
XSLT can be used to produce parameterized xml files. Web.config being xml file this approach works.
You can have one .xslt file(having xpath expressions).
Then there can be different xml files like
1. debug.config.xml
2. staging.config.xml
3. release.config.xml
Then in the postbuild event or using some msbuild tasks the xslt can be combined with appropriate xml files to having different web.config.
Sample debug.config.xml file can be
<Application.config>
<DatabaseServer></DatabaseServerName>
<ServiceIP></ServiceIP>
</Application.config>
.xslt can have xpaths referring to the xml given above.
Can have a look at the XSLT transformation This code can be used in some MSBuild tasks or nant tasks and different web.config's can be produced depending on the input config xml files.
This way you just have to manage the xml files.
There is only one overhead that the xslt file which is similar to web.config need to be managed. i.e whenever there is any tag getting added in the web.config the xslt also needs to be changed.
I don't think you can 100% avoid this.
The last years of work ever and ever shows: where human worked, there are fails.
So, here are 3 ideas from my last company, not the best maybe, but better then nothing:
Write an batch file or an C#.Net Application that change your web.config on a doubleclick
Write a "ToDo on Release"-List
Do pair-realesing (== pair programming while realease :))

Global resources can't be resolved after publishing Website in VS2008

I have a web-project running in VS 2008. We have some global resource files (*.resx) in the App_GlobalResources folder for internationalisation. All this works like a charm on my local IIS installation out of VS.
But when I publish my web-project to the local filesystem and/or another server, all the resources can no longer be found. So I guess the pre-compilation is somehow corrupting stuff. When I call the pre-compiled web, I get an error that the resource object with key xyz cannot be found, although it could be found before.
I checked with .NET reflector if the resource stuff made it into the *.dlls. All those identifiers are there (bin/Web.dll, bin/<culture>/Web.resources.dll). The identifiers are loaded like this:
<asp:MenuItem NavigateUrl="~/OrderNew.aspx" Text="<%$ Resources:MyProject, MenuNewOrder %>" Value="NewOrder">
The resource files are called MyProject.resx and MyProject.<culture>.resx where <culture> corresponds the the specific culture (i.e. MyProject.de-DE.resx).
Any ideas how to solve this?
I really appreciate any help.
Thanks
Edit:
If I copy the App_GlobalResources folder manually to the output, the resources may be loaded normally. So I really really wonder what this pre-compilation is all about.
I'm still interested in solving the issue "the right way".
I had the same issue and had to make two changes to the resx file properties.
Set the "Build Action" to Content
Set the "Copy to Output Directory" to Copy always
(I can't comment on the previous answer...no reputation yet...?)
This did not solve my problem, I'm afraid.
When trying the "Content/Copy Always" solution I get an exception saying that the linking at compile time did not work.
Why does asp.net need the resx file when the resources are compiled in!?
I had this error when copying a resource file from another project.
I solved this by deleting the global resource, adding a new resource and copying the data elements from the old to the new XML.
This results in the following settings for the resource:
<ItemGroup>
<Content Include="App_GlobalResources\Global.resx">
<Generator>GlobalResourceProxyGenerator</Generator>
<LastGenOutput>Global.Designer.cs</LastGenOutput>
</Content>
</ItemGroup>
I had the same issue. Whenever I published my app to the Small Business Server (SBS2008) it stuck on control name line but in fact on meta:resourcekey part of it. Non of the above mentioned solution helpd me.
I spent 6 hour figuring this out, finally I realised that this happend when I did some folder cleenup on the server. At the begning all my apps was located on E: in their folders but then I have created folders with names indicating to apps ApplicationPools and I move coresponding apps there.
I dont know how IIS7 on my SBS looking for resource files but definitely this was the issue. When I get back with my apps to E: again all started working like a charm.

System.IO.FileNotFoundException when loading web service

I've a simple, if not primitive, C++/CLI .NET 2.0 class library. It is used in order to wrap some C++ legacy code for the Web Service. The following facts appear to be true:
Primitive C# test program calls class library and it works.
If class library does not refer to any modules of our code base, it works as well as part of the web service. That is, I load the web service and invoke the methods and receive proper response.
The same moment I replace the copied and pasted code by the calls from our code base libraries, the Web Service stops to load. I get System.IO.FileNotFoundException message.
The problem: I cannot find any place where the file name that couldn't be found is written.
I googled it and gave some permissions to some ASP.NET user on my computer. I copied all the DLLs of our libraries into the same directory where web service is installed. I searched in IIS logs, event logs, etc - no where could I find the name of the module that prevents the web service from coming up.
Any help on the matter would be greatly appreciated.
Boris
Make sure all the dependent DLLs are in the path (Path meaning not the directory where your assembly is, because ASP.net copies your assembly away into a temporary folder, but rather a directory that's included in the System path environment variable).
What calls are you replacing? Could it be the original code gracefully handles missing files (which may not even be important) and yours does not?
Add same rights to the iusr-account that you did to the asp.net-account.

Resources