Error after publishing .net web project - asp.net-mvc-4

I am publishing a project in my local computer, I am getting an error because of the path of the files, in my project I am using relative path, but when i published the project I specified a Site/application so I put: localhost/myapp, but then, after the login the additional name myapp make it loses the path references, do you have any idea how to go through this?

I encountered the same problem with my web application this problem occurs because in your application you are hardcoding paths for ex :- /Home/Index or something which creates problems whenever you want to provide paths use helpers like #Url.Action(),#Html.Action(),#Url.Content() as shown below :-
#Url.Action("Index","Home",new{//specify route parameters here//})
If you are using areas in you application then specify it as :-
#Url.Action("Index","Home",new { area="myarea" })

Related

Adobe analytics with vue js adding external script

Im struggling to add adobe analytics external scripts to my Vue js project. The client uses Adobe analytics and im battling to add it to the project without the project complaining.
The external adobe script looks like the following:
//assets.adobedtm.com/file.min.js with async
Then it is required that you end it by adding the following just before the closing body tag:
<script type="text/javascript">_satellite.pageBottom();</script>
When the project starts it complains in console that $ is not defined because it is defined in webpack when i start the project and im guessing its not finding the alias.
This is the error:
VM29714:3 Uncaught ReferenceError: $ is not defined
Then further down it complains that it doesnt know what _satellite is:
login:54 Uncaught ReferenceError: _satellite is not defined
I just need the scripts and satellite close to be added to the project, the rest will work once these are added.
Ive tried added the scripts by injecting them into the head tag on runtime but that also doesnt work.
If you are implementing Adobe DTM, you cannot inject the header script dynamically. It must be placed directly on the page without async or deferred attributes.
If you are implementing Adobe Launch, you can inject the header script dynamically and asynchronously. And if you do this, you do not include the footer (_satellite.pageBottom()) code.
Your script example isn't explicit, but the .min portion implies you are using Adobe Launch.
VM29714:3 Uncaught ReferenceError: $ is not defined
This is not directly related to either Adobe DTM or Launch. You may possibly have some other script or code block deployed inside the DTM or Launch interface that references $, but that's a separate issue to work out. Yes, it may be coming from a DTM or Launch script according to the js console, but keep in mind that DTM/Launch is a tag manager. It hosts and deploys other tags/scripts. So you need to do some digging to see which tag/script from which Rule references it. Start by looking at the stack trace to find out where it's coming from.

IntelliJ + AWS Toolkit + Serverless App: "Must be able to locate the handler in the project in order to deploy to Lambda"

I have created a new Serverless project in IntelliJ using a HelloWorld style template app.
This app I managed to build, deploy and run remotely in my AWS account. I even managed to integrate it with API gateway to make it accessible through the internet.
As the project is setup, it has 1 Lambda function called HelloWorldFunction. Its handler is called "helloworld.App::handleRequest" and I can see the configuration for this in the template.yaml file.
Now I want to create another Lambda function in the same application project. So, in IntelliJ, I follow these steps:
AWS Explorer > Lambda
Right-click on Lambda
Click "Create new AWS Lambda ..."
enter a function name (e.g. MyNewLambdaFunction)
enter the runtime (Java 8) and the S3 bucket and the IAM role (all is fine)
then I need to enter the name of the "Handler", and this is where my problem starts
I have tried different names here, such as "MyNewHandler", or "helloworld.App::handleRequest" (clearly this wouldn't work because it's already in use by the HelloWorldFunction), "helloworld.App2::handleRequest", .... and so on.
Each time I try another name or way to define the Handler, I get this error message:
Must be able to locate the handler in the project in order to deploy
to Lambda
Question:
Do I need to first configure the new Lambda function in the template.yaml file or what do I need to call the Handler so it will work?
I am sure this is just a noob-error but I have been Googling this and haven't found anyone who has run into the same problem. I also read up on AWS on handlers but it only describes it at a conceptual level and not in practice where there are multiple Lambdas.
thanks for any help!
Andy
My understanding is that you would need to add app2 class to the same package first:
click on the package name → new → Java Class → type app2
Navigate to the implementation of the App2 class and click on the lambda icon in the gutter. You will notice that "Create New AWS Lambda" is added to the dropdown:
When you select it, you will see that "Handler:" field has already been prepopulated correctly:
my understanding is that each handler must be placed in a separate class and the name of the handler handleRequest is standard and provided by the framework
I've had the same issues using pyCharm for Python.
I was able to solve it by using <file name without extension>.<function name> so my file is app.py and the function is lambda_handler so my handler was app.hello_world
It should be noted this is the same as what you see in the "Handler" field when using the AWS web management page.
Thius is how it looks in pycharm:
I got the same issue but solved in a different way;
Quit WebStorm
Delete ".aws-sam" and ".idea" folders
Open the project again.
"Update function code" run without "Must be able to locate the handler in the project in order to deploy to Lambda"

SpaTemplate angular - Publish to Azure - Error: Cannot find module 'aspnet-webpack'

I use the asp.net core angular spatemplate. The project is running without problems on my local machine. However, when I publish it to azure I run into an internal server error.
After setting the aspnetcore_environment to development in the azure portal, I can see a the error:
Exception: Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'
I found some hints here https://github.com/sgbj/generator-aspnetcore-angular2/issues/23
Basically it says the node_modules folder is missing in the production environment. And it describes a way to add it manually to the project.json file. But the spatemplate didn't create such a file... it contains a classic *.proj
I am very new to web development and I don't know how to add the missing dependency to the proj file. And I am not sure if this is really the issue, because the sample I am following on the web https://channel9.msdn.com/events/Visual-Studio/Visual-Studio-2017-Launch/WEB-103 is not setting anything in this direction.
If I create a plain new project with
dotnet new angular
and I publish it everything works fine without any issues?! So I have the feeling I destroyed something in the solution?! Any idea?
My question is how can I set the node_modules for publishing?
In Startup.cs you probably have the below in Configure() method:
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
HotModuleReplacement = true
});
}
This enables hot module replacement with webpack. When you make a change and save a file, webpack automatically re compiles the angular app so your browser picks up the changes without you reloading the page. You don't want this functionality when publishing.
"env.IsDevelopment()" will check for an environment variable on your PC = ASPNETCORE_ENVIRONMENT=Development
In the app service, add an app setting like below:
Alternatively you could comment the hot module replacement out.
Finally I found a solution for this problem. I removed the Publish Profile in my VS2017 solution and to delete the related app service on Azure. After creating everything new again the publishing works well again. I hope this will never ever happen in production.

Running a test yii application gives object not found

I have installed yii 1.1.12 framework(Windows 7 using xampp) and created a mytest project. I am able to see mytest project folder in the path '/xampp/htdocs/yii/framework/'. But while running application as 'http://localhost/mytest/' it gives Object not found error
Thanks,
Gowtham
Probably it's because you created your web app inside the framework folder, so the route localhost/mytest doesn't work. Try using http://localhost/yii/framework/mytest instead

Worklight 6 + Dojo missing files error

I have gone through this post to run an application in production, but facing an issue.
https://www.ibm.com/developerworks/community/blogs/dhuyvett/entry/the_dojo_library_in_worklight_studio_v6_0?maxresults=15&lang=en
I have created a Worklight 6 hybrid application, listed below is a series of tasks that I performed on it.
I built and deployed the project with the 'Provide Library Resources' checked and I get a list of missing files (a few stated below) in the dojo library requests console and the application works fine.
[[2013-11-14 11:02:48] Application 'SampleBankingApp' requested a
missing resource. Providing library resource:
/dojoLib/toolkit/dojo/dijit/form/DateTextBox.js
[2013-11-14 11:02:48] Application 'SampleBankingApp' requested a missing resource. Providing library resource:
/dojoLib/toolkit/dojo/dijit/form/FilteringSelect.js
[2013-11-14 11:02:48] Application 'SampleBankingApp' requested a missing resource. Providing library resource:
/dojoLib/toolkit/dojo/dijit/Calendar.js]
I copied the missing files into the www folder keeping the folder structure as required, then I built and deployed the app with the 'Provide Library Resources' checked and I still get the same list of missing files in the dojo library requests console and the application also works fine.
Now I built and deployed by unchecking 'Provide Library Resources', when I tried to use the app it doesn't work, and the chrome console (where i use the mobile browser simulator) gives a series of errors like Failed to load resource: the server responded with a status of 404 (Not Found).
Whatever missing files it states in the dojo library requests console is in place inside the www folder, don't know whats going wrong.
I am using Eclipse Juno + Worklight6 + Dojo, any help would really be appreciated.
I think you may be failing on copying the resources to the correct path in the "www" folder.
For example, if you are missing /dojoLib/toolkit/dojo/dijit/form/DateTextBox.js, then you should copy that file into your_project/www/dijit/form