I've got a windows service coded in c#, with a config file:
ProcessingService.exe
ProcessingService.exe.config
Its got a webservice endpoint address in it. This initially went in with the wrong address, so I stopped the service, changed the config file and restarted, but the service is still hitting the original URL.
I then restarted the entire server and still the wrong URL is being accessed.
We have a load of corporate rules about new install versions meaning my turnaround time for compiling a new service and getting it installed will be measured in weeks, leaving the URL broken for that entire time. Is there a way to force the config to update?
(Yes, I've triple checked that the config file is now correct!)
In response to the request for the service setup code, I simply do (class names changed):
WebserviceNamespace.ServiceClass client = new WebserviceNamespace.ServiceClass();
The service config shows the original URL, and I'm using a transformed app.config process to overwrite the new URL in the new config file (again, I've triple checked this). I am generating the service classes as internal though, could this be something to do with it?
OK, so I've now tried installing the service on another computer, stopping it, changing the URL in the config to "nevergonnahappen" and restarted. Requests to that now fail on an invalid url. So it must be something to do with our live server specifically...
make sure that your services is pulling the url from config file.
make sure the services is not cached the url somewhere else after getting it(maybe in memory or file or database).
make sure you pointed to correct folder for the config file, perhaps do a wild search with agent ransack, any other place that is still writing broken url and your services in fact is pointing into it.
Related
When I am trying to delete the failed jobs in the production server i am getting 404 error but I am able to delete them in my local PC.
URL
https://mywebsite.com/hangfire/jobs/failed/delete
HTTP ERROR 404
URL
https://localhost:59141/hangfire/jobs/failed/delete
HTTP 200
Can anyone let me know why this is happening on the production server only.
There is only one server behind this url..
Thanks in Advanceā¦
The issue actually I am facing was - I deployed the hangfire application inside the sharepoint website in IIS.
The path deleting the job was something like this on button click
http://SharePointWebsite/MyAapplicationWebSite/hangfire/jobs/failed/delete
This is the path that is getting generated by the hangfire code internally(I added the hangfire assembly reference to my project). My Share Point application due to some configuration issues is not accepting this huge path. So i changed the path to
http://SharePointWebsite/MyAapplicationWebSite/hangfire/jobs/faileddelete
(I removed one "/" in the path) which worked for me.
How to change automatic generated path :
Take the HangFire Code from GitHub which is opensource now
In the Dashboard Pages you will find FailedJobsPage.cshtml. Update this page contents with the short url that you want.
But this cshtml will not be rendered until you run the custom tool - "razor generator tool"(VS Extension) for this cshtml page which generates cs file
You can see these cs files already present in the GitHub Code (expand the cshtml page you will find the cs file)
After finishing the above steps make sure the same path is configured in the DashboardRoutes.cs file as well.
=========================
"ExtensionlessUrlHandler-Integrated-4.0" in "handlers" section
of SharePoint Application web Config is causing the actual issue
I use nancyfx.
I have published a folder with files.
I start the server and observe the following situation:
If there is a file '1.html' in the published folder, then I get it through the browser. If I delete this file from the disk, I get an error 404 (this is correct). If I add this file to disk again, or I change its contents, I normally get it in the browser.
If after starting the server I try to access from the browser to a nonexistent file '2.html', I get an error 404 (This is correct). However, if after that I create the file '2.html' on the disk, I still get a 404 error. It helps only restart the server.
I got the impression that nancyfx at the first access to the requested files forms some kind of cache, which subsequently does not allow me to get the files added after they were unsuccessfully requested.
Help please with the decision of the given problem. Thank you in advance.
Nancy uses a convention based approach for figuring out what static content it is able to serve at runtime. you can check the Documentation here
I have a mvc .NET web application written in C# and I have a web.config file associated with it for web specific configuration values. I also have a windows service application that will be running on the server in the background that has a App.config associated with it. I have linked the file within the web application and can see the file with updated values. But I am unable to use those values in my controller to display them to the UI. Is there a way to make a call to the app.config values to use in the controller and views of the web application? Right now it seems like they are coming in null due to them not being in the web.config.
Any help is apprecaited.
As long as permissions are worked out, you should be able to open the shared config file thusly:
var map = new ExeConfigurationFileMap();
//TODO: resolve this path in whatever way makes sense for your situation.
map.ExeConfigFilename = #"C:\MyConfig.config";
var config = ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
//do something with config, e.g. config.AppSettings.Settings["Blah"];
Otherwise, you can do something like put shared settings into machine.config, but it's typically wise not to mess with that file.
In my silverlight light apps im normally connecting to a ASMX or WCF web service.
I was wonder what is the best way of holding the url in the app of where the soap client should be looking at.
This is fine in debug because it just sort of knows, but in release and depending where its using an ip or it swaps production servers i keep getting tripped up.
I would love there to be some sort of client config bit like web config
Your service endpoints can go in to a ServiceReferences.ClientConfig file. This is then an XML file and can be changed at any point as needed; ie..at deployment, etc...
You can have client configuration by using Isolated Storage.
You work with Key/Value pairs as in this example from the linked page:
// Create an instance of IsolatedStorageSettings.
private IsolatedStorageSettings userSettings =
IsolatedStorageSettings.ApplicationSettings;
// Add a key and its value.
userSettings.Add("userImage", "BlueHills.jpg");
// Remove the setting.
userSettings.Remove("userImage");
So you can have the value as your URL - just choose a suitable key.
Okay, simple situation: I'm writing a simple console application which connects to a SOAP web service. I've imported a SOAP Service reference and as a result, my application has a default endpoint build into it's app.config file.
The web service, however, can run on multiple servers and the URL to the proper web service is passed through the commandline parameters of my application. I can read the URL, but how do I connect the web service to this custom URL?
(It should be very simple, in my opinion. It's something I'm overlooking.)
Is this using an auto-generated class deriving from SoapHttpClientProtocol? If so, just set the Url property when you create an instance of the class.
Well, .NET can provide some very useless error messages sometimes. In IIS, the service was configured to AutoDetect cookieless mode. As a result, I had to append "?AspxAutoDetectCookieSupport=1" to the URL. Although that would fix the problem, it was just easier to go to the IIS console, open the properties of the service, go to the ASP.NET tab page, click the "Edit configuration" button, to to "State Management" in the newly popped up screen and change "Cookieless mode" into something other than "AutoDetect"...
Excuse me. Dumb error. Am going to hit myself on the head a few times for this. ;-)
As Jon said, you set the Url, as in:
Namespace.ClassName nwe = new Namespace.ClassName();
nwe.Url = "http://localhost/MyURL/site.asmx";