Scheduling Tasks in GoDaddy windows shared hosting - asp.net

I am trying to create a scheduled task in GoDaddy windows shared hosting account. I have some logic in my .Net C# class project where I have to call a function on daily basis. I have tried by converting it to an executable(.exe) and configured in godaddy as per
https://in.godaddy.com/help/scheduling-tasks-with-plesk-shared-hosting-8970
But that doesn't work for an .exe.
Eventually I have tried calling that function from an aspx by referencing the class project in the WebApp (because that's what the URL suggests). Now I am blocked with some error which says Exception calling "DownloadString" with "1" argument(s): "URI formats are not supported."
Looks like I am doing something wrong while configuring my aspx.
These are my configuration details:
Path to an executable file:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments:
-c "(new-object system.net.webclient).downloadstring('http://DOMAIN_NAME.in\SOME_FOLDER\Default.aspx')"
Called up GoDaddy folks to provide a sample, But they said they do not any sample for the same (very irritating).
Can Someone help me with this?

Godaddy already removed task scheduler and they no longer support it since March 2018.

I have found the issue with my configuration, in fact I have just managed to make it work, here it is:
ASPX Deployment:
Path to an executable file:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Arguments:
-c "(new-object system.net.webclient).downloadstring('http://YOUR_DOMAIN.in/Default.aspx')"
Note: Default.aspx must be placed in httpdocs folder (This is the default folder where you place your website related files).
PHP Deployment:
Path to an executable file:
C:\Program Files (x86)\Parallels\Plesk\Additional\PleskPHP54\php-cgi.exe
Arguments:
G:\PleskVhosts\readefy.in\httpdocs\YOUR_SCHEDULED_TASK.php
NOTE: Looks like only these 2 options are available for scheduling your tasks via windows shared hosting.

you can create a API and call it by
Executable : C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Argument : Invoke-RestMethod 'mysite.com/API/MethodName"
The Invoke-RestMethod cmdlet sends HTTP and HTTPS requests to Representational State Transfer (REST) web services that returns richly structured data.

Related

Apigee - Java callout, Resource

Apigee java callout:
To execute java callout, I uploaded .jar file at org level in apigee. I made reference of the jar (and Execution class) in java-callout policy, but I get error during deployment of proxy - "Could not extract the java resource". Using curl command I verified that jar is loaded as java type, and name of resource is correct.
curl command used to upload the jar.
curl -v -H "Content-Type: application/octet-stream" -X POST -d#{JARfileName.jar} http://{HOST}/v1/organizations/{ORG}/resourcefiles?"name={JARfileName.jar}&type=java"
Any idea what is the issue?
As mentioned on the documentation page for JavaCallouts, this feature is only available on paid-for Apigee orgs. If you're a paying customer I'd suggest contacting Apigee Support directly to get help with this issue.
I further investigated, it has to do with java class loader - in built(fixed) java class loader sequence is to look for dependencies in proxy-level to Apigee platform level, not in other-direction. Example - you can not reference entry class from jar uploaded at platform level and look for its dependencies at proxy level. Anyway a work-around solution works for me.
Suggestion to Apigee team -
It would be helpful if there is way to define location of dependent jars in Api-proxy(explicit jar location in java callout), this way one can explicitly manage how dependent jar/class is being referenced. And also, will be able to upload common/shared class at platform level and bundle proxy specific configuration at Proxy-level.
Regards,
Kamesh

Log4j in Websphere

I recently take over a web application project using websphere and log4j running under AIX. To create a development environment, I setup all the components in windows, using eclipse to compile a WAR file and deploy it.
All is working fine except that log file is not created.
I changed the log file in log4j.properties from something like in below and and give everyone full access permission to the directory:
log4j.appender.F1.File=/abc/def/logs/admin.log
to
log4j.appender.F1.File=c:/logs/admin.log
What else can I check?
I create a simple standalone testapp which use the same log4j.properties and it can create the log file, but when the servlet deployed to websphere, it doesn't work. Please help! Thanks!
Ok, I think this article should help you. It seems that WebSphere CE uses log4j by default and controls it with a global properties file. There is a section on how to use application-specific properties files.
Here is what I try and do to troubleshoot similar issues.
Turn on log4j debugging to see where it actually picks up the file from. You need evidence of which file is picked up (so turning the debug on is a worthwhile activity) This provides you information with what log4j is trying to do to locate the configuration file.
-Dlog4j.debug=true
I would not hardcode the log4j location in the code. Instead I
would use the log4j.configuration System property and state that in
the JVM arguments. This way even I don't need to touch my code.
-Dlog4j.configuration=file:///home/manglu/log4j.properties
I would use this approach irrespective of the runtime server that I use (be it Tomcat or WAS CE or WAS)
Hope this helps
I suggest you use environment variables set on your server like this :
You must access the admin console of your server.
Under custom properties
Server_path=/abc/def/logs
In your log4j, use this : {$server_path}/log.txt
Make sure the user running the app has access to that directory.

Problem with Team Build 2010 and web.config transformation

I'm struggling to get web.config transformations working with automated builds.
We have a reasonably large solution, containing one ASP.NET web application and eight class libraries. We have three developers working on the project and, up to now, each has "published" the solution to a local folder then used file copy to deploy to a test server. I'm trying to put an automated build/deploy solution in place using TFS 2010.
I created a build definition and added a call to msdeploy.exe in the build process template, to get the application deployed to the test server. So far, so good!
I then tried to implement web.config transforms and I just can't get them to work. If I build and publish locally on my PC, the "publish" folder has the correct, transformed web.config file.
Using team build, the transformation just does not happen, and I just have the base web.config file.
I tried adding a post-build step in the web application's project file, as others have suggested, similar to:
<target name="AfterBuild">
<TransformXml Source="Web.generic.config"
Transform="$(ProjectConfigTransformFileName)"
Destination="Web.Config" />
</target>
but this fails beacuse the source web.config file has an "applicationSettings" section. I get the error
Could not find schema information for the element 'applicationSettings'.
I've seen suggstions around adding arguments to the MSBuild task in the build definition like
/t:TransformWebConfig /p:Configuration=Debug
But this falls over when the class library projects are built, presumably because they don't have a web.config file.
Any ideas? Like others, I thought this would "just work", but apparently not. This is the last part I need to get working and it's driving me mad. I'm not an msbuild expert, so plain and simple please!
Thanks in advance.
Doug
I just went through this. Our build was a bit more complicated in that we have 8 class libraries and 9 web applications in one solution. But the flow is the same.
First off get rid of your after build target. You won't need that.
You need to use the MSDeployPublish service. This will require that it be installed and configured properly on the destination server. Check the following links for info on this part:
Note that the server in question MUST be configured properly with the correct user rights. The following sites helped me get that properly set up.
http://william.jerla.me/post/2010/03/20/Configuring-MSDeploy-in-IIS-7.aspx
http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html
How can I get TFS2010 to run MSDEPLOY for me through MSBUILD?
The next part requires that your build definition have the correct MSBuild parameters set up to do the publish. Those parameters are entered in the Process > 3.Advanced > MS Build Arguments line of the build definition. Here's a hint:
(don't change the following for any reason)
/p:DeployOnBuild=True
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=False
/p:MSDeployPublishMethod=WMSVC
/p:SkipExtraFilesOnServer=True
/p:AllowUntrustedCertificate=True
(These control where it's going)
/p:MSDeployServiceUrl="https://testserver.domain:8172/msdeploy.axd"
/p:UserName=testserver\buildaccount
/p:Password=buildacctpassword
/p:DeployIisAppPath="MyApp - TESTING"
Obviously the user will have to be configured in IIS on the target server to be allowed access to that axd (see previous links). And the IisAppPath is the name of the website on the target server.
You won't have to do anything special for the config transformations as the build itself will take care of that for you. Just have the correct setting in the line at Process > 1. Required > Items to Build > Configurations To Build.
Instead of trying to do the deploy by adding tasks myself into the build process template, I followed advice in Vishal Joshi's blog post here.
Now the entire project is built and deployed and the web.config transformations work also. Brilliant!
I now have another problem to solve! The web application references web services and the build process results in an XmlSerializers dll. However, although this is built OK, it does not get deployed to the web host. I think this needs a new post!
Doug

How to consume web service with WSDL file?

have been given a URL to a WSDL, a piece of it is here..not sure if this is a pertinent piece or not. I know how to add the web reference and import the namespace in Visual Studio 2005.
Questions...how do I pass my values to it? How do I encode for binary-64? I have the methodname (GETP)...not sure how to invoke it as a function to pass parameters, or if that is even the correct way to do it with this type of reference. Have only consumed .asmx files previously.
<wsdl:message name="GETPResponse">
<wsdl:part name="GETPReturn" type="xsd:string" />
</wsdl:message>
<wsdl:message name="GETPRequest">
<wsdl:part name="BASE64DATA" type="xsd:base64Binary" />
</wsdl:message>
<wsdl:portType name="Dist">
<wsdl:operation name="GETP" parameterOrder="BASE64DATA">
<wsdl:input message="impl:GETPRequest" name="GETPRequest" />
<wsdl:output message="impl:GETPResponse" name="GETPResponse" />
</wsdl:operation>
</wsdl:portType>
Just use "Add Service Refrence" and point it to the WSDL. See "How to Consume a Web Service".
This site has how to create a WSDL class and use that, or how to reference the web service using a Visual Studio web reference: https://msdn.microsoft.com/en-us/library/ms155134.aspx
Neither option worked for me. I needed to create the WSDL class like at that site, but the web reference didn't work for me, and neither did just adding that class to my App_Code folder and trying to instantiate it. So I opted to create an assembly out of the WSDL class, then reference that assembly in my project. This was the only way I could get any useful classes/methods available to me. Here are my general steps, from start to finish, that worked for me.
Ensure you have the right URL at the top in your ASMX.cs file of your web service: [WebService(Namespace = "http://localhost:99999/WebService1.asmx")]
Leaving that as the default "tempuri.org" will cause you unbearable grief.
Get the Windows SDK for your workstation/server & install.
On a command line, navigate to WSDL, which for me on Server 2012 was: cd C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
Then, use this: wsdl /l:CS /protocol:SOAP http://localhost:99999/WebService1.asmx?wsdl
You can then do one of 2 things:
The proxy class will be generated in that same folder where you navigated on the command line. Go to it in Explorer, copy it into a
new Class Library Visual Studio project, at the root of the
solution. (For details, go to
https://msdn.microsoft.com/en-us/library/cc175801(v=vs.90).aspx and
skip to "Creating a Project for the Proxy Assembly".) Sign the
assembly (details on that same site, section "Signing and Building
the Proxy Assembly"). (I didn't bother with the serialization
exceptions or struct stuff - just those 2 sections, only.)
-OR- (easier)
Just use CSC to build your assembly:
Move your proxy class to the
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 folder.
Launch a command line and cd to that folder.
Run this command:
csc /t:library MyWebServiceProxyClassFile.cs /reference:System.Web.Services.dll /optimize
Obviously, replace "MyWebServiceProxyClassFile" with the name of your proxy class file. It will give you a DLL file with the same name as your proxy class.
Import the assembly in your client project by going to Add Reference and browsing to the assembly in that proxy project you just built in step 4. It should be in the MyServiceProxy\bin\Debug folder. (Or browse to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727 if you left it there, from using CSC.)
Instantiate using the class name of your web service:
YourClass service = new YourClass();
You should see the webmethods available when you do service. with intellisense.
You'll likely need to add these parameters:
service.Url = "http://localhost:99999/WebService1.asmx";
service.Credentials = CredentialCache.DefaultCredentials;
(Add using System.Net; to the top of your class to use that last one.)
For those saying this is the "old" or "obsolete" way of doing it, I say this worked for me, and would say to tell Microsoft to make it work using the web reference and we wouldn't have to do it this way. Besides, this is largely their documented process, after all, with some of my own findings put in. And I noticed something else - svcutil generates a totally different, WCF-compliant proxy class, which WSDL does not, so be careful what utility you are actually using - they are NOT created equal.
Also, I made my own batch file for creating a proxy class from a web service, then building an assembly from it using CSC, like I have above:
echo off
cls
cls
set /P svc="Input the URL to your web service's Service.asmx file: "
cd \
cd C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools
wsdl /l:CS /protocol:SOAP %svc%?WSDL
set /P name="Type the name of the service's class' name (no .cs on end): "
move %name%.cs C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\%name%.cs
cd \
cd C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
csc /t:library %name%.cs /reference:System.Web.Services.dll /optimize
move %name%.dll C:\%name%.dll
move %name%.cs C:\%name%.cs
echo Your DLL and Proxy Class are waiting for you at
echo.
echo C:\%name%.dll
echo.
echo. and
echo.
echo. C:\%name%.cs
echo.
explorer.exe C:\
pause
cls
exit
This is set up to run on Server 2012 with the Windows SDK installed. You could run it on any platform if you change the place wsdl is found to point to Visual Studio's SDK folder, if you install that, ex:
cd "C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin"
instead of that NETFX Tools folder.
You would use it by first entering the URL of the web service, ex.
http://localhost:99999/WebService1.asmx
When the class is generated, you give this program the name of the class file, minus the .cs. It should also be the same as the default class name at the top of WebService1.asmx.cs, in my example.
It will then leave the proxy class and assembly file at the root of C: for you.
For those wishing to pursue converting the ASMX into a WCF interface, I found this: https://msdn.microsoft.com/en-us/library/vstudio/ms751529%28v=VS.100%29.aspx
that looked promising, which has you use svcutil to produce the proxy, I'm assuming add it to an ASP.NET App_Code folder (it doesn't say) and add a service reference to the ASMX web service URL, but not a lot of detail/guidance on how to name the contract and where to put that <client> snippet in the web.config, though I believe it goes in <system.ServiceModel>.

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